[fpc-devel] UTF-8 string literals

Sven Barth pascaldragon at googlemail.com
Fri May 5 16:16:18 CEST 2017

Am 05.05.2017 15:55 schrieb "Michael Van Canneyt" <michael at freepascal.org>:
> On Fri, 5 May 2017, Mattias Gaertner wrote:
>> On Fri, 5 May 2017 14:30:32 +0200 (CEST)
>> Michael Van Canneyt <michael at freepascal.org> wrote:
>>> [...]
>>> > AFAIK FPC stores UTF-8 string literals (-Fcutf8) as widestrings
>>> > instead of UTF8String. Please correct me if I'm wrong.
> To make sure I was presenting correct facts, I did some tests.
> As a result of the tests, I think the above statement is wrong.

In all three cases you are either explicitly or implicitly forcing the
compiler to convert it to Ansi/UTF-8 and since it's a constant it takes a
compiletime shortcut.
If you'd do a Writeln without the typecast then it will be a UTF-16
constant that is stored in the binary *if* the string contains a character
> $7F.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170505/e2771d06/attachment.html>

More information about the fpc-devel mailing list