[Lazarus] Lazarus (UTF8) and Windows: SysToUTF8, UTF8ToSys... Is there a better solution?

Hans-Peter Diettrich DrDiettrich1 at aol.com
Thu Dec 26 00:28:54 CET 2013


Marco van de Voort schrieb:

> The only problem on Windows is that you must only pass a string with a very
> clear encoding to a RTL function.  
> 
> so 
> 
>  assignfile(f,s+s2+s3);  
> 
> is dangerous if they are not all the same encoding. If there is any
> mismatch, it will be converted down to default encoding.

Then the implementation is wrong. All string conversion is done via UTF 
(lossless), the result can be either UTF-8 (FPC) or UTF-16 (Delphi). The 
final conversion depends on the target, i.e. the declaration of AssignFile.


> There is no utf8 on Windows.

Yep, that's why the Unicode (W) API should be used. No problem with
UTF-8 strings there :-)

DoDi






More information about the Lazarus mailing list