PeekS() does not work properly in unicode mode under Windows

Just starting out? Need help? Post your questions and find answers here.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Re: PeekS() does not work properly in unicode mode under Win

Post by Rescator »

uwekel wrote:1. Why does it perfectly work under Linux (i guess because Windows codepage)?
2. How can i get the same result on Windows as on Linux?
To answer #1
Probably because Linux ditched Ascii ages ago in favour for Unicode. On Linux "Ascii" is really UTF8.
On Windows Ascii is 7-bit. 8 bit strings on Windows are not UTF-8, they are instead codepages and each language tens to have their own. So German Windows will probably have a German codepage (or possibly Latin-1 / ISO 8859-1).

As to #2
You may have to look into the Codepage/Multibyte Windows APIs. You will need to convert from the system codepage to unicode.


Tip!
If possible, make sure the server/machine you are fetching the data from is sending you UTF-8 strings/text instead of Ascii. That way you can use Peeks with the #PB_UTF8 flag and it will remain correct regardless of system language or system default codepages.
When writing/sending strings/text you should make sure that the text is also UTF-8 (use PokeS and #PB_UTF8 flag for that).
Post Reply