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

Everything else that doesn't fall into one of the other PB categories.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

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

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

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

Post 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.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

Thanks very much for that. Is the messagerequester() unicode aware also?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> Is the messagerequester() unicode aware also?

Should be if you go to Compiler menu -> Compiler Options -> Tick: Create Unicode Executable.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

PB - you're the man! Thanks very much for your kind help. That worked a treat.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Added the editor question to the FAQ. :)
Last edited by PB on Sat Feb 04, 2006 2:24 pm, edited 1 time in total.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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.)
quidquid Latine dictum sit altum videtur
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post 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.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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.
Post Reply