[fpc-devel] String and UnicodeString and UTF8String

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Jan 14 13:21:41 CET 2011


Sven Barth schrieb:

>>> Widestring will also grind the application to a halt due to being COM
>>> based
>>> on Windows.
>>
>> How that?
>>
>>
> 
> WideString on Windows has no reference counting, thus everytime a 
> WideString is assigned it needs to be copied.

I'm not so sure of that. AFAIR the field exists, but it's unused or 
reserved for shared memory management.

Of course the requirement, that a BSTR has to reside in shared memory, 
discourages the use of exactly that type for stringhandling inside an 
application.

I only wanted to prevent the introduction of another "UTF16String" type, 
in addition to WideString, BSTR (WinAPI) and UnicodeString (Delphi). 
Conversion-wise WideString/BSTR and (other) UTF-16 strings are equivalent.


> Nearly all Windows API functions only allow single byte encodings or 
> UTF-16. The only functions that I'm aware of, that can use UTF-8 
> encoding is the console input/output API (if the codepage is set to 
> UTF-8) [and also file I/O APIs, but they don't assume any encoding].

And the conversion functions of course (MBCStoWStr...).

DoDi




More information about the fpc-devel mailing list