Specifying the Code Page of a Text File

If you forget the code page of a text file that's not part of a project, you cannot determine the code page, because a text file doesn't have a code page mark as .dbf files have. The best way to remember the code page of a text file is to add the file to a project.

To specify the code page of a text file

  1. Open the Project Manager.

  2. Select the text file whose code page you want to specify.

  3. From the Project menu, choose Project Info.

  4. In the Project Information dialog box, click the Files tab.

  5. Right-click the selected file.

  6. From the submenu, choose Code Page.

    Visual FoxPro displays the Code Page dialog box.

  7. Choose the appropriate code page.

    Visual FoxPro displays the available code pages.

If you know the code page of a text file, you can specify it by using the AS clause of the appropriate Visual FoxPro command. For files you want to import or append, you can specify the code page in the IMPORT or APPEND commands. For query, program, and other text files already on your computer, you can change the code page using the MODIFY QUERY, MODIFY COMMAND, and MODIFY FILE commands.

If you're not sure which code page to apply, substitute the GETCP( ) function for the code page number in the command. GETCP( ) displays the Code Page dialog box, making it possible for you to select the appropriate code page.

Note   Some characters cannot be translated between code pages successfully. In addition, some code page translations aren't supported by Visual FoxPro. Always check the results of a code page change to be sure that your data has been translated successfully.

See Also

Specifying the Code Page of a .dbf File | Determining the Code Page of a Project File | Developing International Applications | Specification of Code Pages for Variables | Preventing Translation of Data in Character or Memo Fields