Page 1 of 1

PB4: unicode - how to use it in the PB editor

Posted: Sat Feb 04, 2006 11:59 am
by mskuma
Hi, Firstly thanks Fred & the team for the PB4 update - as a new user I was looking forward to it, especially the unicode support. So I'd like to ask perhaps a really dumb (potentially embarrassing) question here.. I'd like to use it for storing/using Japanese as unicode strings. I tried the following simple example:

Code: Select all

a.s = "‚±‚ñ‚É‚¿‚Í"
MessageRequester("test",a)
a.s contained a Japanese string. The IDE seems to not support unicode or at least when I enter Japanese, it appears as garbled chars and when I run it, the message box also has garbled strings. So I created the same source using notepad saving as unicode & tried to open it in the editor, but PB wanted to open the file as a hex doc. Ideally it would be great if the IDE would support unicode as well as the compiler, or maybe it does - I'm simply missing something?

So essentially the question is how can I use unicode in PB4? Do I still need to use the ANSI to unicode conversion routines I've seen on this board before?

Thanks.

Re: PB4: unicode - how to use it in the PB editor

Posted: Sat Feb 04, 2006 12:27 pm
by PB
According to the PureBasic Survival Guide ( http://www.xs4all.nl/~bluez/datatalk/purebasic.htm ):

If you want to enter Unicode characters in the editor, you have to switch this option on! File / Preferences / Editor / Use UTF8.

Posted: Sat Feb 04, 2006 12:36 pm
by mskuma
Thanks very much for that. Is the messagerequester() unicode aware also?

Posted: Sat Feb 04, 2006 12:46 pm
by PB
> Is the messagerequester() unicode aware also?

Should be if you go to Compiler menu -> Compiler Options -> Tick: Create Unicode Executable.

Posted: Sat Feb 04, 2006 12:49 pm
by mskuma
PB - you're the man! Thanks very much for your kind help. That worked a treat.

Posted: Sat Feb 04, 2006 1:11 pm
by PB
Added the editor question to the FAQ. :)

Posted: Sat Feb 04, 2006 2:09 pm
by freak
Another tip:

If you want to debug unicode strings, it is better to use the standalone
debugger (Preferences / Debugger / Select it in the combobox on top),
because the standalone one has a full unicode version, the one in the IDE
must convert to ascii before displaying. (this will change. dunno when though.)

Posted: Sat Feb 04, 2006 4:14 pm
by Nik
Hmm it seems that PBs Standard Font isn't a Unicode one an so onlöy understands a minority, changing to a Unicoe font helps, but you should consider to take a Unicode Font as standrad when available, it's also astonishing that my System Font (Windows XP German) doesn't support many Unicode characters either.

Posted: Sat Feb 04, 2006 4:17 pm
by Fred
We use the standard unicode font, what unicode characters have you tested ? If you want to test japanese, you will have to install the IME Japanese for XP.