Code: Select all
string$ = "onetwo"
bytes = Len(string$)*2+2
*buf = AllocateMemory(bytes)
MultiByteToWideChar_(65001,0,@string$,Len(string$),*buf,Len(string$))
Debug PeekS(*buf,bytes,#PB_Unicode)
Code: Select all
string$ = "onetwo"
bytes = Len(string$)*2+2
*buf = AllocateMemory(bytes)
MultiByteToWideChar_(65001,0,@string$,Len(string$),*buf,Len(string$))
Debug PeekS(*buf,bytes,#PB_Unicode)Saving as UTF-8 only influences the way your source code is stored.Korolev Michael wrote:Save this as UTF-8 and compile as Unicode executable. Why it returns single "o" instead of "onetwo"?

Not exactly.Korolev Michael wrote:@wilbert u mean, string is already in UTF-16 LE format?

The code you write in the editor is stored in UTF-8 format on disk if you specify this. This enables you to use foreign language characters in your code.Korolev Michael wrote:String is stored in UTF-8. Purebasic app, compiled in U-mode, loads string into memory and automatically converts it to UCS2?