Unicode, Codepage 437, and line characters

#1
I am using;
Code:
TCC  20.11.40 x64   Windows 7 [Version 6.1.7601]
TCC Build 40   Windows 7 Build 7601  Service Pack 1
I remember reading, quite a while ago on this forum, about Unicode, Codepage 437, and line characters, however, I now cannot find it.

I am re-compiling some of my Turbo Pascal DOS code to FreePascal x86-64. The problem is with line drawing characters. For example;
Code:
GotoXY(XCor-1, yCor-1); Write(#218);             
FOR co := 1 to Wid DO Write(#196); Write(#191);  
FOR ro := yCor to yCor + Choices -1 DO           
  BEGIN                                         
    GotoXY(xCor-1, ro); Write(#179);             
    GotoXY(xCor+Wid, ro); Write(#179);           
  END;                                           
  GotoXY(XCor-1, yCor+Choices); Write(#192);     
  FOR co := 1 to Wid DO Write(#196); Write(#217);
...produces this with Codepage 437 under 4DOS 8.00;
capture1.JPG
..but produces this with Codepage 437 under Windows;
Capture.JPG

CHCP under both OSes returns;
Code:
Active code page: 437
The @FONT function returns;
Code:
Font[0] = Consolas
Font[1] = 6
Font[2] = 12
Font[3] = 700
Font[4] = 54
Font[5] = 6
I would appreciate either links to the previous answers on this question (I am sure it has been asked before), or any new constructive solutions.

Thanks!

Joe
 

rconn

Administrator
Staff member
May 14, 2008
10,533
94
#4
This is one of the rare cases where a non-Unicode font works better.

The line drawing characters in Terminal are high-bit ASCII (128-255) characters. The line drawing characters in Unicode are mapped to different locations -- if you use something like DRAWBOX / DRAWxLINE in TCC, it will use the Unicode characters, not the ASCII characters.