Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-03

How to display special characters

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Nevalainen

Hi

Sorry to bother you with trivial newbie question
but the links to the archives seem broken right now.

How can I display special characters outside the standard A-Z range in the WIN32 environment?

I am using

    writeln('some strange chars like �, � etc');

but it displays other characters instead. Those above are ascii codes 132 and 148 in case you wondered or they dont dislay correctly.

I have codepage 850 active. Any suggestions?

_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com

Reply by email

Marco van de Voort
to Juha Nevalainen
Show quoted text 12 lines
Sorry to bother you with trivial newbie question but the links to the archives seem broken right now. How can I display special characters outside the standard A-Z range in the WIN32 environment? I am using writeln('some strange chars like �, � etc'); but it displays other characters instead. Those above are ascii codes 132 and 148 in case you wondered or they dont dislay correctly.

Ascii codes above 128 can change with codepage.

I have codepage 850 active. Any suggestions?

Change to code page 437.

Reply by email

Rich Pasco
to Juha Nevalainen: Hi Sorry to bother you with trivial newbie question but the links to the archives seem…

Codepages 437 and 850 are the DOS characters used in a command-shell window. Codepage ISO-8859-1 is the Windows character set used in Windows GUI applications. You can get into trouble if you use a Windows GUI editor for source code for applications that will run in a command-shell window, or vice versa.

For example, e-acute is #$82 in codepages 437 and 850, but #$E9 in codepage ISO-8859-1. If you wanted to write the Spanish word "olé" in a command-shell application, you would write "ol"+#$82, but for a windows-GUI application you would write "ol"+#$E9.

For another example, a-umlaut is #$84 in codepages 437 and 850, but #$E4 in codepage ISO-8859-1. If you wanted to write the German word "spät" in a command-shell application, you would write "sp"+#$84+"t", but for a windows-GUI application you would write "sp"+#$E4+"t".

I hope this helps.

- Rich

Juha Nevalainen wrote 14 lines
Sorry to bother you with trivial newbie question but the links to the archives seem broken right now. How can I display special characters outside the standard A-Z range in the WIN32 environment? I am using writeln('some strange chars like ä, ö etc'); but it displays other characters instead. Those above are ascii codes 132 and 148 in case you wondered or they dont dislay correctly. I have codepage 850 active. Any suggestions?

Reply by email

Juha Nevalainen

That helps a lot, many thanks. That is exactly my problem (using Windows GUI editor while porting a command window application). If I wanted to maintain original text readability (there is lots of text with lots of specials chars in this program), the only way then is to switch back to text mode editor then, right?

How about printing - is that all in ISO-8859-1 too? Will I need the Windows character sequences for that part then?

Cheers
Juha

Show quoted text 47 lines
From: Rich Pasco Reply-To: To: Subject: Re: [fpc-pascal]How to display special characters Date: Tue, 19 Mar 2002 10:17:33 -0800 Codepages 437 and 850 are the DOS characters used in a command-shell window. Codepage ISO-8859-1 is the Windows character set used in Windows GUI applications. You can get into trouble if you use a Windows GUI editor for source code for applications that will run in a command-shell window, or vice versa. For example, e-acute is #$82 in codepages 437 and 850, but #$E9 in codepage ISO-8859-1. If you wanted to write the Spanish word "ol�" in a command-shell application, you would write "ol"+#$82, but for a windows-GUI application you would write "ol"+#$E9. For another example, a-umlaut is #$84 in codepages 437 and 850, but #$E4 in codepage ISO-8859-1. If you wanted to write the German word "sp�t" in a command-shell application, you would write "sp"+#$84+"t", but for a windows-GUI application you would write "sp"+#$E4+"t". I hope this helps. - Rich Juha Nevalainen wrote: > Sorry to bother you with trivial newbie question > but the links to the archives seem broken right now. > > How can I display special characters outside the standard > A-Z range in the WIN32 environment? > > I am using > > writeln('some strange chars like �, � etc'); > > but it displays other characters instead. Those above are ascii > codes 132 and 148 in case you wondered or they dont dislay correctly. > > I have codepage 850 active. Any suggestions? _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com

Reply by email

Rich Pasco
to Juha Nevalainen
Juha Nevalainen wrote
If I wanted to maintain original text readability (there is lots of text with lots of specials chars in this program), the only way then is to switch back to text mode editor then, right?

If you want to read your strings in the source code, then you need to edit them in the same codepage as you execute them in. But for code portability, do something like this:

const
{$ifdef DOS_CHARS}
  eacute = #$82;
  a-umlaut = #$84;
{$else} (* Windows characters *)
  eacute = #$E9;
  a-umlaut = #$E4;
{$endif}
...
begin
  ...
  WriteLn("ol"+eacute);
  WriteLn("sp"+aumlaut+"t");
  ...
How about printing - is that all in ISO-8859-1 too? Will I need the Windows character sequences for that part then?

It depends on how you print. If you print from a Windows app (e.g. Notepad), then yes, the characters must be in ISO-8859-1. But if you pipe your program output directly to PRN (the printer device) then use your printer's native character set (consult the printer manual).

- Rich

Reply by email

Arne Hanssen
to Juha Nevalainen: That helps a lot, many thanks. That is exactly my problem (using Windows GUI editor…
Juha Nevalainen wrote 8 lines
That helps a lot, many thanks. That is exactly my problem (using Windows GUI editor while porting a command window application). If I wanted to maintain original text readability (there is lots of text with lots of specials chars in this program), the only way then is to switch back to text mode editor then, right? How about printing - is that all in ISO-8859-1 too? Will I need the Windows character sequences for that part then?

I guess that depends on your printer - if you send init-strings to the printer selecting the desired codepage before print, your should be ok (as long as we talk about ASCII printouts - if you mean windows functions for "graphic" prints, I don't know).

Vennlig hilsen / Best regards Arne Hanssen

Reply by email

Juha Nevalainen

Its just basic text output but I really need to have a kind of generic Windows printer support. Many people with different printers will be using this app, and some with USB port connected printers also.

I tried the program from Szabo in the forum:
http://deadlock.et.tudelft.nl:10000/bboard/q-and-a-fetch-msg.tcl?msg_id=0000Fl&topic_id=14&topic=Developing%20for%20Windows

My printer made many promising sounds but unfortunately no text came out in the end.

What next?

Show quoted text 31 lines
From: Arne Hanssen Reply-To: To: undisclosed-recipients:; Subject: Re: [fpc-pascal]How to display special characters Date: Tue, 19 Mar 2002 20:13:31 +0100 On Tue, 19 Mar 2002 20:42:03 +0200, Juha Nevalainen wrote: > That helps a lot, many thanks. That is exactly my problem (using Windows > GUI editor while porting a command window application). If I wanted to > maintain original text readability (there is lots of text with lots of > specials chars in this program), the only way then is to switch back to text > mode editor then, right? > > How about printing - is that all in ISO-8859-1 too? Will I need > the Windows character sequences for that part then? I guess that depends on your printer - if you send init-strings to the printer selecting the desired codepage before print, your should be ok (as long as we talk about ASCII printouts - if you mean windows functions for "graphic" prints, I don't know). -- Vennlig hilsen / Best regards Arne Hanssen _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

_________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

Reply by email

Rich Pasco
to Juha Nevalainen
Juha Nevalainen wrote
Its just basic text output but I really need to have a kind of generic Windows printer support. Many people with different printers will be using this app, and some with USB port connected printers also.

I know it's a round-about approach, but I have some of my Free Pascal applications write a PostScript file, which I then convert to PDF using Ghostscript, and then open that with Acrobat Reader and print.

Of course, someone who has a PostScript printer can skip the last two steps and send the PostScript file directly to the printer--but this bypasses the Windows printer drivers, which was not what you wanted.

- Rich

Reply by email

Unknown author
to Rich Pasco: Codepages 437 and 850 are the DOS characters used in a command-shell window. Codepage…

Date sent: Tue, 19 Mar 2002 10:17:33 -0800
From: Rich Pasco
To:
Subject: Re: [fpc-pascal]How to display special characters Send reply to:

Codepages 437 and 850 are the DOS characters used in a command-shell window. Codepage ISO-8859-1 is the Windows character set used in Windows GUI applications. You can get into trouble if you use a

.
.

Just a little correction - Windows doesn't really use ISO codepages (like ISO 8859-1 for the so-called Latin-1 set), as opposed to *nix. Microsoft uses a different set of codepages, which were derived from the ISO ones originally, but still differ quite a lot (why should they use some existing standard instead of creating their own, right? :-( ). So the Windows equivalent for ISO 8859-1 (and CP 850 known from e.g. DOS) is codepage 1252 (called windows-1252 as well because of the IANA registered name of that character set).

Tomas

Reply by email