[fpc-pascal] FPC 3 regression: cannot use TStringList for UTF-8 data any more?

tobiasgiesen at gmail.com tobiasgiesen at gmail.com
Mon Apr 4 10:43:42 CEST 2016


> > I use TStringList for UTF-8 strings. This is no longer possible, because
> > automatic conversions cause question marks and data loss.
> 
> Lazarus uses TStringList with UTF-8 all over the place.
> 
> Please post a complete example demonstrating the problem.

Sorry - this was only theoretical, because of the Backward compatibility
section on the FPC Unicode Support page.

It says that a "defined way" to use strings is "you do not store data in
an ansistring that has been encoded using something else than the
system's default code page, and subsequently pass this string as-is to
an FPC RTL routine".

That would mean I cannot use TStringList for UTF-8.  The paragraph is
misleading, really. Very theoretical. What you really need to tell
people is something like this:

"Unicode aware Pascal code needs to set DefaultSystemCodePage to
CP_UTF8".

I am sorry but I was really shocked this morning when I saw the question
marks :)

Cheers,
Tobias




More information about the fpc-pascal mailing list