Crt functions WhereX and GotoXY do not work well with UTF8 characters
Original Reporter info from Mantis: Antonio Puente
-
Reporter name: Antonio Puente Rodero
Original Reporter info from Mantis: Antonio Puente
- Reporter name: Antonio Puente Rodero
Description:
The function WhereX and the procedure GotoXY do not work well with UTF8 characters in console programs,
I have verified that the count of characters in each line is done as if the characters were ASCII (1 byte/char) instead of UTF8 (variable length). The errors on the horizontal position match the number of bytes of the Utf8 characters that have been output.
Steps to reproduce:
Run the program:
program CrtTest;
uses Crt;
begin
Writeln('1234567890');
Write('∀∀'); // '∀' is the Unicode char U+2200
GotoXY(8, WhereY);
Write('AA');
Readln;
end.
The program should output the following lines to the terminal:
1234567890
∀∀ AA
However the result that I have got is:
1234567890
∀∀ AA
Additional information:
I have tested the program with Ubuntu 12.4 running on an I-386 PC
I have tested also the same program with PascalGUI on Android Jelly Bean (ARM processor) and I have got the same result.
I have not tested the programa with BSD Unix, but I gruess that the result would be the same.
Crt seems to be designed to work only with OEM and ANSI charsets, where the length of each character is always 1, but fails on systems that use Unicode Utf8.
Mantis conversion info:
- Mantis ID: 25662
- OS: Linux
- OS Build: Ubuntu 12.4
- Platform: Text console
- Version: 2.6.2