Microsoft KB Archive/67584

= Active Code Page Versus Selected Code Page =

Article ID: 67584

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 3.1
 * Microsoft MS-DOS 3.2 Standard Edition
 * Microsoft MS-DOS 3.21 Standard Edition
 * Microsoft MS-DOS 3.3 Standard Edition
 * Microsoft MS-DOS 3.3a
 * Microsoft MS-DOS 4.0 Standard Edition
 * Microsoft MS-DOS 4.01 Standard Edition
 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a
 * Microsoft MS-DOS 6.0 Standard Edition
 * Microsoft MS-DOS 6.2 Standard Edition
 * Microsoft MS-DOS 6.21 Standard Edition
 * Microsoft MS-DOS 6.22 Standard Edition

-



This article was previously published under Q67584



SUMMARY
The COUNTRY command in CONFIG.SYS can be used to specify a code page that CHCP then reports. However, the code page is not really made active. The MODE command reports &quot;No code page has been selected&quot; and KEYB reports &quot;Active code page not available from CON device.&quot;

This behavior is a result of the difference in the definitions of an &quot;active&quot; code page and a &quot;selected&quot; code page. The system has a global &quot;active&quot; code page that it attempts to use when accessing any code page supported device. Additionally, each of these devices has a &quot;selected&quot; code page. The global (active) code page and the individual device code page (selected) do not necessarily match.



MORE INFORMATION
The COUNTRY command sets the initial active &quot;global&quot; code page, but does not select that code page for each device. The CHCP command reports and changes the global code page, and also attempts to select that code page for each of the code page devices. You can bypass the CHCP command and change a device's selected code page directly by using the MODE command as follows:   MODE CON CODEPAGE SELECT=xxx This selects code page xxx for the CONsole device without affecting the code page used by the other devices or the global active code page.

In summary:


 * COUNTRY sets the country information, and sets the initial global code page, but does not set code pages in the device drivers.
 * MODE [CON PRN] CODEPAGE SELECT sets the code page used by a device driver, but does not affect the global active code page.
 * CHCP sets the global code page, and issues the equivalent of a MODE [CON PRN] CODEPAGE SELECT command for each device it finds.

Complete code page installation includes use of a COUNTRY command, and the loading of the CON and/or PRN device in the CONFIG.SYS, plus loading of NLSFUNC, a MODE CON/PRN CODEPAGE PREPARE command, and a CHCP command in the AUTOEXEC.BAT.

The following example (from page 331 of the &quot;Microsoft MS-DOS User's Reference&quot; version 4.0) demonstrates the interactions of COUNTRY, MODE, and CHCP:   CONFIG.SYS --  country=049,,a:\country.sys device=display.sys con:=(ega,437,1)

AUTOEXEC.BAT nlsfunc mode con codepage prepare=((850)a:\ega.cpi) chcp 437
 * 1) After booting:


 * 1) * CHCP reports 437 as the active code page.
 * 2) * MODE CON CODEPAGE reports that 437 is the active (&quot;selected&quot;) code page for the CON device.
 * 3) After issuing a CHCP 850 command:


 * 1) * CHCP reports 850 as the active code page.
 * 2) * MODE CON CODEPAGE reports 850 is the active code page for the CON device.
 * 3) After issuing a MODE CON CODEPAGE SELECT=437 command:


 * 1) * CHCP reports 850 as the active code page.
 * 2) * MODE CON CODEPAGE reports 437 as the active code page for the CON device.

The &quot;No code page has been selected&quot; error occurs because a code page has not yet been selected for the device with CHCP or a MODE CON CODEPAGE SELECT= command. KEYB also suffers from the same problem: it requires that a code page be selected for the device.

Additional query words: 6.22 3.30 3.30a 4.00 4.01 5.00 5.00a 6.00 6.20

Keywords: KB67584

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.