[fpc-pascal] CRT unit and Windows' terminal

Tony Whyman tony.whyman at mccallumwhyman.com
Sat Oct 14 16:16:04 CEST 2017


It may be worth looking at the SetTextCodePage in the System unit. On 
Windows targets I often find it necessary to include

SetTextCodePage(output,cp_utf8);

to avoid problems writing UTF-8 to the console.


On 14/10/17 08:12, pascalX at piments.com wrote:
> On 13/10/17 14:39, James Richters wrote:
>> I‘ve tried Writeln(Chr(9556)) but chr() has a limit of 255, and I’ve 
>> tried just Writeln(#9556) and while that compiles and runs, it 
>> doesn’t produce the correct character.. I have a feeling (but have 
>> not tested it) that it keeps cycling around the first 256 characters 
>> if you use anything above 255….. pretty sure a character is defined 
>> as a byte here.
>
>
> Thanks for that lengthy description of the problem, much better than 
> OP's just describing output as rubbish, or something similar.
>
> since char is a single byte type a large value will just get 
> truncated. If you turn on range checking it should return a compiler 
> time error. You could check that.
>
> Maybe doing that would cast some light on what is going wrong in CRT 
> as well.
>
> P
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list