Lino Website

Problem reports

prnprint and chcp

Sunday, 10. September 2006 21:11.

prnprint has problems when printing in another codepage than the default console codepage. I created a file cp437box.txt to reproduce the problem.

cp437box.txt uses some less common box characters that exist in cp437 but not in cp850.


This file was designed to use cp437 and *not* cp850.

But although running chcp 437 on my notebook (whose default console codepage is 850) will make it appear correctly, prnprint will still print it using cp850. As if it ignores the changed codepage.

The following session had a PostScript printer as Default Printer, and Ghostscript installed.

T:\svnwork\lino\trunk>chcp 437
Active code page: 437
T:\svnwork\lino\trunk>lino prnprint -o c:\ tests\testdata\cp437box.txt
Lino prnprint
Copyright (c) 2004-2006 Luc Saffre.
This software comes with ABSOLUTELY NO WARRANTY and is
distributed under the terms of the GNU General Public License.
See file COPYING.txt for more information.
Using Lino 0.6.20, Python 2.3.4 final, Python Windows Extensions, PIL
tests\testdata\cp437box.txt : 1 page has been printed
T:\svnwork\lino\trunk>start c:\

CreateFont() has a parameter called «charset», but this cannot be used to select a specific codepage. Selecting anything else than OEM_CHARSET results in complete garbage (because «modern» character sets have no box characters at all).

It is not possible to print to a Windows printer using the OEM_CHARSET and another codepage than the default codepage.

Note that even the DOS box (cmd.exe) must use a TrueType and not a raster font in if you want to switch between codepages using chcp.

But can I change the default console codepage of a machine? Yes: How to change the default console codepage.

Refering articles:

Copyright 2001-2007 Luc Saffre.
Generated 2007-06-07 16:22:49