El 23/03/2022 a las 10:51, Mattias Gaertner via fpc-pascal escribió:
FPC does not yet understand comments,
What do you mean with "understand comments"?
so maybe it does not know this
literal is cp1252. Add {$codepage cp1252} somewhere at the start of
the unit.
If this is part of a Lazarus application, then String is by
default UTF-8, so your "original" is already converted to UTF-8.
So, as far as Ive understood, without {$codepage cp1252}, when I read
the string from a file, it supposes it is utf8, even when it is not a
valid utf8 string.
And ansiToUtf8 doesn't suppose that the input string ansi, but utf8? I
can't understand what is ansiToUtf8 for.
If you want to load a string encoded in CP1252, then you
can use from unit lconvencoding:
s:=CP1252ToUTF8(StringFromFile);
OK. that is the solution I've chosen.
Thanks
Mattias
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
--
Saludos
Santi
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal