I need to display utf8 string in console (using write and writeln command). Initially everything was fine... until I added crt to the uses clause.
All the utf8 string now became '?'. After searching the forum, I found 'unicodecrt' unit which is supposed to be unicode enabled (
https://forum.lazarus.freepascal.org/index.php/topic,35037.msg302211.html#msg302211). With this unit, the writeln command is able to display utf8 string but some characters are missing (everty alternative character is missing - see screen shot attached). However if I use WriteConsole API then all the whole string will be displayed.
What can I do to make the writeln command work properly?
My code is as follows:
s1 := '一一二二三四五六七八九十';
writeln(s1);
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), @s1[1], Length(s1), nil, nil);
writeln;
writeln;
s2 := 'あ'+'あ'+'が'+'が'+'あ'+'が'+ 'に'+ 'に';
writeln(s2);
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), @s2[1], Length(s2), nil, nil);
readln;
TQ