[fpc-pascal] Different default ASCII tablein fpc IDE with SP3 installed

Noel and Marie nandm at adam.com.au
Tue Jun 22 02:38:24 CEST 2010


Tomas,

I tried two of your suggestions.

1.
 In a command shell I went to the working directory c:\fpc\2.2.0\demo\text 
then entered chcp.
The response was: Active code page: 850
I then entered chcp 437
The response was: Active code page: 437
I then ran the program squareroot_n.exe   which has a line:    write('Square 
root ', chr(251));
However, it still printed superscript 1 rather than the square root symbol.


2.
I modified the source code to now use the Windows  unit as well as the crt 
unit.
I added the following lines:
  writeln( getConsoleCP);
  writeln(  getConsoleOutputCP);
  setConsoleOutputCP(437);
  writeln( getConsoleOutputCP);

The output was :
   850
   437
   437

and unfortunately, still the superscript 1 instead of the desired square 
root symbol in response to the instruction to write( 'Square root ', 
chr(251));


Thank you again for your suggestions but I wonder if you could suggest 
anything else before I embark on trying to learn about widestrings and 
unicodes.

Noel


----- Original Message ----- 
From: "Tomas Hajny" <XHajT03 at hajny.biz>
To: "FPC-Pascal users discussions" <fpc-pascal at lists.freepascal.org>
Sent: Monday, June 21, 2010 6:27 PM
Subject: Re: [fpc-pascal] Different default ASCII tablein fpc IDE with SP3 
installed


On Mon, June 21, 2010 10:19, Noel and Marie wrote:


Hello,

> Recently SP3 for XP was installed on my PC.
>
> An fpc 2.2.0  program that previously displayed a square root symbol when
> instructed to write chr(251) now displays a superscript 1. In other words,
> the character set displayed in the IDE through Tools ->ascii table is
> different from the one previously displayed.
>
> Can you give instructions on how to have the program use the former
> character set please?

There are several options for you:

1) Change the console code page to the preferred character set before
starting the program (e.g. by calling 'cp 437' on the command line or from
a batch file before invoking your program). Advantage: No change to the
program is required. Disadvantage: Change necessary on each and every
machine where the program runs.

2) Change the console code page to the preferred character set using the
Win32 API from within the program. Advantage: No user changes necessary.
Disadvantage: Platform dependent change (if you aim to support multiple
platforms), no chance for the user to use a different character set (i.e.
no possibility of displaying characters used in other languages any
longer).

3) Start using widestrings / Unicode characters. Advantage: Your programs
becomes completely independent from the used character set and allows
reliable displaying of whichever characters you may need (as long as they
are supported by the installed fonts, of course). Disadvantage: Depending
on the way your program is currently written / output to console is
performed, major changes to your program may be necessary.

Hope this helps

Tomas


_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list