[fpc-pascal] question about changing default ASCII table in the fpc 2.2.0 IDE

Tomas Hajny XHajT03 at hajny.biz
Mon Jul 5 22:02:37 CEST 2010

On 25 Jun 10, at 8:07, Noel and Marie wrote:

Hi Noel,

> Thanks Tomas.  I didn't see your promise to look at the problem.

Sorry, it took somewhat longer, but the results are here:

1) It works as expected if _not_ using unit Crt.

2) There is a bug in implementation of unit Crt for Windows. This bug 
stems from May 2006 already and it was a result of a patch from Maxim 
Ganetsky trying to fix bug #6785 
(http://bugs.freepascal.org/view.php?id=6785). Since that patch, all 
output with unit Crt uses the so called ANSI code page under Windows 
which is IMHO wrong. I've added a comment to bug #6785 and filed a 
new bug report (http://bugs.freepascal.org/view.php?id=16846) - you 
may want to monitor that one in order to be notified when it gets 

Until the bug is fixed, there are several possible solutions for you, 

- You may comment line 699 (and preferably also line 743) in your 
local copy of rtl/win/crt.pp (trunk version from SVN) and recompile 
RTL (and packages). That isn't a complete fix, but it should probably 
be sufficient for your needs.

- If you only need to output this one particular character, you may 
do so using the particular Win32 API directly. Admittedly not very 
nice and certainly not portable, but at least a possible workaround.

- If you don't need unit Crt, you may simply remove it from your uses 

>   I have just relied on email replies for comments etc. How do I look at all 
> comments, other questions, etc on the Web?

Sorry, I'm not sure if I understand this question. Do you refer to an 
archive of this mailing list? If so, you can find a link on the FPC 
WWW pages (under Mailing lists).

Hope this helps


> ----- Original Message ----- 
> From: "Tomas Hajny" <XHajT03 at hajny.biz>
> To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
> Sent: Thursday, June 24, 2010 11:59 PM
> Subject: Re: [fpc-pascal] question about changing default ASCII table in the 
> fpc 2.2.0 IDE
> On Thu, June 24, 2010 06:41, Noel and Marie wrote:
> > Hello,
> >
> > I would like to print a square root symbol using  write(chr(251)); as I
> > could before SP3 for XP was installed on my PC.
> >
> > Currently am getting a superscript 1 rather than the square root symbol
> > from
> > write(chr(251)).
> >
> > I've tried the following kind suggestions of Tomas Hajny, unfortunately
> > without success:
> >
> > 1.   In a command shell I entered
> >          CHCP 437     and then ran the program
> >
> > 2.  Modified the source code to include the Windows unit and added line
> > setConsoleOutputCP(437);,
> >         compiled and then ran the program.
> >
> >
> > I  examined the registry settings   in directory Codepage.
> >         Name              Data
> >       (default )         (value not set)
> >         ...
> >         ACP                1252
> >         MACCP        10000
> >         OEMCP            850
> >         OEMHAL        vgaoem.fon
> >
> >         Changed OEMCP to 437     and got an accented 'u'.   Then restored
> > the system.
> >
> > I wonder if anyone can suggest a solution to the problem.
> I still intend to have a look at it (as promised previously), just had no
> time for that (if noone else provides answer till then).
> Tomas

More information about the fpc-pascal mailing list