[fpc-pascal] Unicode chars losing information

Adriaan van Os fpc at microbizz.nl
Mon Mar 8 11:59:20 CET 2021


adriaan% cat uniquizz-utf8.pas

{$codepage utf8}

program uniquizz;
var
   chars: UnicodeString;
begin
   chars := '⌘ key';
   writeln(chars);
   writeln(chars[1]);
   writeln( 'size ', sizeOf( chars));
   writeln( 'length ', length( chars));
end.

adriaan% fpc uniquizz-utf8.pas -FcUTF-8
Free Pascal Compiler version 3.0.4 [2018/09/30] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling uniquizz-utf8.pas
Assembling (pipe) uniquizz-utf8.s
Linking uniquizz-utf8
14 lines compiled, 0.1 sec

[l24:~/gpc/testfpc] adriaan% ./uniquizz-utf8
? key
?
size 8
length 5

----

This leaves me with a question mark too.

Regards,

Adriaan van Os


More information about the fpc-pascal mailing list