Windows Code Pages

Windows Code Pages

Top  Previous  Next

 

This section does not apply to the ECS mode version of QM.

 

Within Windows QMConsole sessions, single-byte characters are displayed as defined by the current codepage. The default page is set by Windows based on your regional settings but it can be changed at any time from the QM command prompt, within a paragraph, or by EXECUTE within a Basic program by updating the CODEPAGE private configuration parameter or by use of the PTERM command.

 

Use of code pages allows language localisation. Single-byte characters in the range 127 to 255 are mapped to accented letters (such as é and õ), special characters (such as ç  and ß), and symbols (such as the Euro and Trademark signs). There are not enough single-byte characters for all the languages of the world, so different mappings have been set up for different regions. Microsoft calls these mappings code pages.

 

Word processing software packages such as Notepad handle the choice of code page through the choice of font. Fonts have been built for many languages, some provided with Windows, others available for download from Internet sites. Choose the correct font, and the special characters will display as needed.

 

This method cannot be used by software such as QM which runs as a Windows console process either directly or via the Windows command prompt. Within processes run in this way, there is just one font (Lucida console) available for use with multiple languages. The characters displayed are determined by which code page has been made current. Any given installation of Windows has a default code page, and several other code pages available. More information can be found on Internet sites that specialise in language issues.

 

Note that selection of a codepage controls character display within QM – how characters appear at the command prompt, in LIST output, within ED and SED, etc. A file written by a QM program, when viewed in a Windows application such as Notepad or Excel, will show the characters as seen by that Windows application.

 

Code pages are identified by numbers, usually of 3 or 4 digits. The codepage used by QM can be controlled by use of the CODEPAGE configuration parameter. Setting a value for this parameter in the QM configuration file will determine the default page used. This can be changed within a session by use of CONFIG or PTERM.

 

Some of the pages that may be available in a Windows system include:

 

850"Multilingual (Latin-1)" (Western European languages)
852"Slavic (Latin-2)" (Eastern European languages)
855Cyrillic
857Turkish
1250East European Latin
1252West European Latin
1253Greek
1257Baltic
1258Vietnamese

 

To find out whether your copy of Windows has a particular code page available, go into the command prompt and enter “chcp codepage”. This will return an error message if codepage is not available.

 

To view the page in use by a QM session, execute either of the following commands:

PTERM DISPLAY

PTERM CODEPAGE

 

To change the code page in a QM session, execute either of the following commands:

CONFIG CODEPAGE page

PTERM CODEPAGE page

 

Use of some code pages may also require the TXCHAR configuration parameter to be set appropriately. This parameter controls whether QM uses the OEM character translation modes of Windows. It defaults to 1 (use translation) but can be turned off for the current process using the CONFIG command or for all processes by setting parameter to zero in the configuration file.

 

If there is a need to display special characters that are not supported by any of the available code pages, it is possible to modify the Lucida Console font to display them. This can be done by the following steps:

Obtain a font editor (e.g. FontCreator) from a supplier who specializes in font support. The font editor needs to have the ability to associate the graphic form of a character - called its "glyph" - with the byte that is to represent that character - called its "mapping".

Find the existing Lucida Console font, which a file, probably named "lucon.ttf", located in the Fonts folder. The font name is one of the data items within the font file, so is distinct from the name of the file. Windows can see the file as Lucida Console, even though it may have been given another file name.

Copy the original file to another folder, to keep a backup in case something goes wrong with any of the rest of these stops. Then copy it to another file name, such as "myfont.ttf".

Look in the character mapping of "myfont.ttf" for characters that are not needed. The "per thousands" sign, dagger, and double dagger are possible examples.

Using the font editor, replace the glyphs of the characters that are not needed with the glyphs of the characters that are needed.

Test "myfont.ttf" by copying it into the Fonts folder. Then go into QM Console, do LIST, ED, etc, to confirm that characters display correctly. Any Windows software that gives a choice of fonts should display the same way when Lucida Console is specified. This would include Notepad, word processing, and spreadsheet products.

 

Like any other software, the font needs to be carefully backed up, and shared with whatever users may need it. Fonts are subject to copyright, so property rights must be respected. It may be necessary to get legal advice.