Get a unicode char from a code

Just starting out? Need help? Post your questions and find answers here.
SP
User
User
Posts: 33
Joined: Wed Aug 16, 2006 2:32 pm
Location: BCN-SPAIN

Get a unicode char from a code

Post by SP »

Hi,

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

Greetings
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

If you're compiling in unicode mode:

Code: Select all

Chr(Number)
SP
User
User
Posts: 33
Joined: Wed Aug 16, 2006 2:32 pm
Location: BCN-SPAIN

Post 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
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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)
SP
User
User
Posts: 33
Joined: Wed Aug 16, 2006 2:32 pm
Location: BCN-SPAIN

Post by SP »

Thanks Trond

Greetings
Post Reply