CRT unit is not displaying characters correctly
Original Reporter info from Mantis: James_Richters
-
Reporter name: James Richters
Original Reporter info from Mantis: James_Richters
- Reporter name: James Richters
Description:
The CRT unit changes how characters are displayed on the console in windows. It is not consistent with MAC or Linux versions of CRT that display Unicode correctly nor is it consistent with the way Turbo Pascal 7.0 displays characters, and it is also not consistent with the way a console program displays without the CRT Unit.
It is actually impossible to display ANY of the box drawing characters, either with extended ASCII codes (#179 to #218) or Unicode (#9472 (closed) - #9599), while using the CRT unit. These box characters are way more important than all the various ways of putting accents over and around characters, especially if the character set is not represented in its entirety, because the box characters allow you to output very nicely professional tables and such, but the accented characters are of no use unless the character set is complete and you can use ALL the exact accents you would need.
It should display either the entire extended ASCII or the entire Unicode character sets on a standard windows console screen without any modifications to the console window, and it should do so by default without any additional setting required.
Since displaying only the first 256 characters of Unicode is worthless, if there is a limitation of 256 characters, then the Extended ASCII character set should be used and mapped to properly display the Extended Ascii characters, with the default Consolas font. since this is a complete character set and is compatible with Borland Pascal 7 which the CRT unit is supposed to be compatible with.
Steps to reproduce:
Run the sample programs provided with CRT and without CRT and with FPC for Windows, Mac and Linux, and Turbo Pascal V7 to observe the differences in the way characters are displayed.
5 Sample programs are included.
- Ascii box.pas Original ASCII box drawing program from Borland Pascal V7
- Asciibox2.pas Simpler test program that just does a bunch of Writeln's run with UNIT CRT; and with Unit CRT; commented out and compare the results;
- ASCII box3.pas Same Asciibox2 but it uses the Unicode versions of the box characters, again run with and without UNIT CRT; to see the differences
- ASCII Box4 same as Asciibox3, but the Unicode character numbers are used instead of the actual characters
- ASCII Box5 is the same as Ascii box 4 but with the original Extended ASCII codes instead.
The results are all posted in screenshot compilations showing results in Lazarus, Free Pascal Text IDE, and Turbo Pascal V7.0 here:
http://www.productionautomation.net/FPC/ASCII/
Additional information:
See the page I created about this here:
http://www.productionautomation.net/FPC/ASCII/
The above page includes sample programs, and screenshots of the results running these programs with Lazarus, FreePascal Text IDE, and Turbo Pascal 7 for comparison.
I have done extensive tests and provided screenshots to show that the CRT unit is not consistent with anything at all. In my opinion, since the CRT unit itself states:
"Borland Pascal 7 Compatible CRT Unit - win32 implentation" <-- (note typo in Implementation)
It should produce truly compatible results on a windows system, that means accepting the Extended ASCII character set from 0 to 255 and translating the characters as needed so they show up as the correct symbols on a standard windows console, with the default Consolas Font.
If it's decided that it should directly display Unicode instead, Then it should accept and properly display the entire Unicode character set, which it currently does not do. displaying the first 256 characters of a character set that contains thousands of characters is of no use to anyone. If Unicode was used there should be a TP7 compatibility mode it could be used in that would make it compatible as intended, and this should be the default setting because the purpose of the unit is TP7 compatibility