You are currently offline, waiting for your internet to reconnect

Understanding Code Pages in Visual FoxPro

This article was previously published under Q129631
This article discusses Code Pages in Visual FoxPro and covers the followingtopics:

  • Description of a Code Page.
  • How Visual FoxPro Uses Code Pages.
  • Using Code Pages in the Development Environment.
  • Checking for Code Page Marks in .DBF Files.
  • Entering Code Page Characters Not Represented by Keys on the Keyboard.
  • Using Code Pages from Earlier Versions of FoxPro.
  • Code Pages Supported by Visual FoxPro.

Description of a Code Page

A code page is a set of characters specific to a language or hardwareplatform. In Visual FoxPro, a code page is a table of characters andcorresponding numbers in memory that Visual FoxPro uses to display dataproperly.

Some characters available in one code page are not available in another,and accented characters are not represented by the same values acrossplatforms and code pages.

How Visual FoxPro Uses Code Pages

When you create a file with a table file structure, Visual FoxProautomatically gives it a code page mark, indicating which code page thefile uses. For example, if you enter the letter C in a .DBF file, theletter is stored on your hard disk as the number 67. When you open thefile, Visual FoxPro determines its code page, inspects the code page tofind the character corresponding to the number 67, and then displays thecharacter (C) on your monitor.

Using Code Pages in the Development Environment

Visual FoxPro supports many code pages and each code page containscharacters unique to certain locales. If you want to create an applicationfor a specific locale, you must create the application's components usingthe code page designed for that locale and environment. For example, tocreate an application for use in Russia, you should use code page 1251,866, or 10007 for users in the Windows, MS-DOS, or Macintosh environments,respectively.

TIP: To create successive files with the same code page, first specify thecode page by setting the CODEPAGE parameter in the CONFIG.FPW file. Thenrestart Visual FoxPro before creating the files.

Checking for Code Page Marks in .DBF Files

You can determine whether a .DBF file has a code page mark by using theCPDBF() function after opening the file or by having Visual FoxPro checkwhen you open the file. To check for code page marks automatically:

  1. From the Tools menu, choose Options.
  2. Select the Data tab.
  3. Set the Prompt for Code Page check box, if it is not already set.
To save this setting for future sessions of Visual FoxPro, choose Set asDefault.

Entering Code Page Characters Not Represented by Keys on the Keyboard

If you need to enter characters not represented by keys on your keyboard,you must enter these characters using the ALT key in conjunction with keyson the numeric keypad. However, remember that the same key combination indifferent environments often displays different results. For example, ifyou enter ALT+0182 with code page 1252 in Visual FoxPro, you see aparagraph symbol. In contrast, if you enter ALT+0182 with code page 437 inFoxPro for MS-DOS, you see a graphic character with a double vertical linemeeting a single horizontal line.

Using Code Pages from Earlier Versions of FoxPro

If you use a file from an earlier version of FoxPro, the file might nothave a code page mark. If the mark is missing when you open the file,Visual FoxPro prompts you for a code page and then marks the file with it.However, if the code page is incorrect, some characters in the file mightnot display properly. If this happens, remove the code page mark, and thenadd the appropriate mark.

TIP: Instead of setting the Prompt for Code Page check box, you can use theSET CPDIALOG command to check for code pages.

Code Pages Supported by Visual FoxPro

Although Visual FoxPro supports many code pages, only a few are used often.With Visual FoxPro, for example, English-speaking users typically use codepage 1252. However, with Visual FoxPro for MS-DOS, English-speaking userstypically use code page 437. The following table shows the code pagessupported in Visual FoxPro for each platform, and the corresponding codepage identifier.
Code page      Platform                    Code page identifier---------------------------------------------------------------437            U.S. MS-DOS                 x01620        (1) Mazovia (Polish) MS-DOS     x69737        (1) Greek MS-DOS (437G)         x6A850            International MS-DOS        x02852            Eastern European MS-DOS     x64861            Icelandic MS-DOS            x67865            Nordic MS-DOS               x66866            Russian MS-DOS              x65895        (1) Kamenicky (Czech) MS-DOS    x68857            Turkish MS-DOS              x6B1250           Eastern European Windows    xC81251           Russian Windows             xC91252           Windows ANSI                x031253           Greek Windows               xCB1254           Turkish Windows             xCA10000          Standard Macintosh          x0410006          Greek Macintosh             x9810007      (1) Russian Macintosh           x9610029          Macintosh EE                x97				
NOTE: (1) This code page is not detected when you include CODEPAGE=AUTO inyour configuration file.
For more information about code pages, please see the "Understanding CodePages" topic in the Visual FoxPro Help menu.

Article ID: 129631 - Last Review: 08/12/1999 14:01:00 - Revision: 1.1

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • kbenv KB129631