[fpc-pascal] Problem with string conversion
marc at dommelstein.net
Fri Oct 20 20:26:43 CEST 2006
Felipe Monteiro de Carvalho wrote:
> On 10/20/06, Vincent Snijders <vsnijders at quicknet.nl> wrote:
>> This should be
>> WideText := GetMem(Size*2);
>> because you get the number of characters, and the number of bytes 2*
>> number of
> Thanks, it works, but I still have doubts.
> 1) On linux I will need that cwstring unit, right? This was a utf-8
> test to be used on fpGUI, and possibly LCL. So can´t we just add
> cwstring on another unit instead of the first of the program?
> 2) Does this work in case my string contains characters bigger then
> #FFFF ? I mean, it seams that we suppose that each character will have
> 2 bytes, but this may not be true.
IMO, Utf8ToUnicode should return the number of bytes the unicode string
requires and not the number of characters. Since even for unicode, one
char may take more than one word.
I don't know what it returns atm.
More information about the fpc-pascal