[Lazarus] TStrings, Windows and Unicode

Howard Page-Clark hdpc at talktalk.net
Wed Oct 24 15:27:44 CEST 2012


On 24/10/12 12:40, Marcos Douglas wrote:

>> Nope.
>> A stringlist is not LCL and it does not expect anything but strings.
>
> I agree...
>
>> If you write the contents of a stringlist to a file you get bytes you have
>> put into the list. Nothing more nothing less.
>
> Yes, but...
>
>> If you want a UTF8 text file written, make sure you put UTF8 in it.
>> Same for reading.
>> When using filenames, you need to convert the name using the LCL function
>> LCLtoSys (or something like that)
>
> ...in my example I didn't do that and worked, why?

Because you added a UTF8 string to a stringlist. It was saved as UTF8 
bytes (as Marc pointed out) and when later retrieved via a stringlist 
LoadFromFile call those bytes will be inserted into the stringlist just 
as they were saved, ready to display in UTF8 encoding.

Howard





More information about the Lazarus mailing list