Extended ASCII use lazarus / 21-General ---------------------------------------------------------------------- raymond · 2021-12-31 10:34 Am using fpc 3.2..2 x86_64 with Linux Mint 20.1 cinnamon Was using fpc with DOS - code page 850 - data in various languages. Files for that period were converted for UT8 with   iconv -f CP850// -t UTF-8 linuxfile In linux the tools 'less', 'cat', 'head' & 'gedit' display the 'European' characters correctly, as does 'lp' In fpc program   PROGRAM this; {$CODEPAGE UTF8}   VAR this_str : STRING;   BEGIN this_str := 'ÄÇ'; WRITELN (this_str); END. 'less', 'head', 'lp' show correctly but not WRITELN (this_str); What magic am I missing? ---------------------------------------------------------------------- tetrastes · 2021-12-31 10:59 Remove {$CODEPAGE UTF8} or add Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses cwstring; It is better to avoid using {$CODEPAGE } at all, because of this (quote from https://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus): QuoteWhat happens when I use $codepage utf8? FPC has very limited UTF-8 support. In fact, FPC only supports storing literals as either "default" encoded 8-bit strings or widestrings. So any non default codepage is converted to widestring, even if it is the system codepage. For example most Linux/Mac/BSD use UTF-8 as system codepage. Passing -Fcutf8 to the compiler will store the string literal as widestring. At run time the widestring literal is converted. When you assign the literal to an AnsiString the widestring literal is converted using the widestringmanager to the system encoding. The default widestringmanager under Unix simply converts the widechars to chars, destroying any non ASCII character. You must use a widestringmanager like the unit cwstring to get correct conversion. Unit LazUTF8 does that. ---------------------------------------------------------------------- raymond · 2022-01-03 13:59 Thank you. The tiny program runs properly with the cw string modification. ---------------------------------------------------------------------- tetrastes · 2022-01-03 14:05 Using cwstring makes it not so tiny . It is better to remove $CODEPAGE directive, as I wrote.