Am 07.05.2017 um 10:30 schrieb Mattias Gaertner via Lazarus: > On Sun, 7 May 2017 10:10:26 +0200 > Florian Klaempfl via Lazarus <[email protected]> wrote: > >> Am 05.05.2017 um 13:35 schrieb Graeme Geldenhuys via Lazarus: >>> On 2017-05-05 12:17, Mattias Gaertner via Lazarus wrote: >>>> I wonder if it would help if FPC would store UTF-8 string literals as >>>> UTF-8 >>> >>> Yeah, that would be the logical thing to do. >> >> Why? What makes a string literal UTF-8? > > Here: $codepage utf-8 and non ASCII. > > >>> FPC not doing that is what >>> really confused me. >> >> You have to distinuish between source encoding and string encoding. > > Yes, but sometimes the string encoding is not obvious: > > {$codepage utf8} > const s = 'äöüالعَرَبِيَّة'; > begin > writeln(s); // needs widestringmanager > end.
Yes. Which is good imo. The compiler should call the unicode writeln in this case and this requires a widestringmanager (where I agree, its name is chosen wrong, it should be named unicodestringmanager) anyways. If the string were encoded UTF-8 and the ansistring writeln is called, your example would work only on a system with an utf-8 console. But you can achieve the same (broken output) by just leaving away the codepage directive then. It will not work on non utf-8 consoles either. -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus-ide.org/listinfo/lazarus
