Page 1 of 1

Get a unicode char from a code

Posted: Sun Oct 01, 2006 12:30 pm
by SP
Hi,

How can I get the corresponding unicode character from a gived code number?

Greetings

Posted: Sun Oct 01, 2006 2:26 pm
by Trond
If you're compiling in unicode mode:

Code: Select all

Chr(Number)

Posted: Sun Oct 01, 2006 3:53 pm
by SP
Hi Trond,

Is possible to get unicode characters without compiling in unicode mode?
I need to know it to interpret the characters sended by external device.

Thanks in advance.
Best regards

Posted: Sun Oct 01, 2006 4:38 pm
by Trond
The problem is that you can't represent all the unicode characters as ascii characters. If you don't care about that then you can still use Chr(UniCharacter.w).

To convert an entire string:

Code: Select all

UniStr = AllocateMemory(10)
PokeW(@UniStr, 'A')
PokeW(@UniStr+2, 'B')
PokeW(@UniStr+4, 'C')

Debug PeekS(@UniStr, 3, #PB_Unicode)

Posted: Sun Oct 01, 2006 4:57 pm
by SP
Thanks Trond

Greetings