Understanding Code Pages in Visual FoxPro
Visual FoxPro displays data using one code page. By default, this is the current code page used by Windows. However, you can override the Windows code page by specifying an alternative code page in your configuration file (you must specify a valid code page).
Tables in Visual FoxPro are tagged with the code page that was in use when the table was created. When you use the table, Visual FoxPro checks the code page for the table against the current code page. If they match, Visual FoxPro displays the data as is. If there is no code page for the table (for example, the table was created in an earlier version of FoxPro), Visual FoxPro prompts you for a code page and then marks the file with it.
When reading data from a table tagged with a code page that does not match the system code page, Visual FoxPro attempts to translate characters from the table code page into the current one. For example, if you're using Visual FoxPro and the current system code page is the English code page, the character is represented by ANSI value 252. If the code page for the table represents the character as ANSI value 219, Visual FoxPro translates all instances of ANSI value 219 into ANSI 252 so that they display properly.
Code page translation doesn't work perfectly in all instances, because code pages usually contain characters that are not represented one-for-one in other code pages. For example, you cannot map data that contains the MS-DOS line-drawing characters into Windows because the Windows code pages don't contain line-drawing characters. Similarly, you cannot translate data created in the Russian code page into an English code page because there isn't a one-to-one correspondence between the alphabets for these languages. Finally, Visual FoxPro might not contain a character translation map for a particular code page. In that case the data is displayed with no code page translation. (Visual FoxPro does not display an error to indicate that no code page translation is occurring.) Any of these situations can cause some characters to display improperly.
When writing data to a table tagged with a code page does not match the system code page and character data is modified, Visual FoxPro attempts to translate characters from the current code page into the table one. For example, if you're using Visual FoxPro and the current system code page is the English code page, the character is represented by ANSI value 252. If the code page for the table represents the character as ANSI value 219, Visual FoxPro translates all instances of ANSI value 252 into ANSI 219 so that they are saved properly.
If you want to create an application for a specific locale, you can avoid code page translation problems by creating the application's components using the code page designed for that locale and environment. For example, to create an application for use in Russia, you should use code page 1251. For a complete list, see Code Pages Supported By Visual FoxPro.
If you need to enter some characters not represented by keys on your keyboard, you can enter these characters using ALT in conjunction with keys on the numeric keypad. However, remember that the same key combination in different environments often displays different results. For example, if you enter ALT+0182 with code page 1252 in Visual FoxPro, you see a paragraph symbol. In contrast, if you enter ALT+0182 with code page 437 in FoxPro for MS-DOS, you see a graphic character with a double vertical line meeting a single horizontal line.
Although Visual FoxPro supports many code pages, only a few are used often. Typically, English-speaking users use code page 1252.
When working with code pages, be sure to test that the user interface and data display correctly by using the code page designed for a particular locale. If you see unexpected characters on the screen, check the underlying code page.