• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Unicode and MessageBox

Started by Patrice Terrier, December 31, 2011, 01:16:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

Do you know how we could display an UNICODE string with the standard MessageBox API.
I am unable to display correctly mandarin or cyrillic with it.

:-[
 
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

If you have it in a variable that already contains it as Unicode, simply use MessageBoxW.

If you need to use string literals, as the PB compiler does not compile unicode files you need to use UTF8:


MessageBoxW(0, Utf8ToChr$("官话"), "Simplified Chinese", %MB_OK)


where "官话" is "官话" UT8 encoded.

Patrice Terrier

José, Thank you!

I have been trying to display a variable that already contains it as Unicode, but i couldn't get it to work.
It seems that the only way to have it working with PB, is to use Utf8ToChar$ wathever the variable being used.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

The CSED editor allows you to use unicode literals, that are automatically converted to UTF8 when saved, and to unicode when displayed. Therefore, you can use:


MessageBoxW(0, Utf8ToChr$("官话"), "Simplified Chinese", %MB_OK)