[fpc-pascal] String literals and code page of .pas source file

Jonas Maebe jonas at freepascal.org
Sat Sep 12 17:46:54 CEST 2020


On 12/09/2020 16:58, Santiago A. via fpc-pascal wrote:
> https://wiki.freepascal.org/Unicode_Support_in_Lazarus#Assign_string_literals_to_different_string_types
> is scaring.

The first table is useless. If you don't tell the compiler what the code
page is of the source file, it's normal that you will get issues all
over the place.

The second table looks more worrying. Where are the bug reports for the
cases where it fails? I would have to look at them more in detail to
find the causes, but at first sight it indicates several implementation
bugs.

> All the doubts, questions, and discussions prove that current system is
> counter-intuitive and confusing.

The issue in this thread is caused by a bug in the LCL: it blindly
assumes that the dynamic code page of the caption string is always
utf-8. That is simply wrong (unless you put the burden on the user to
always assign an utf-8-encoded string to it, but _that_ is
counter-intuitive and confusing).


Jonas


More information about the fpc-pascal mailing list