How to: Specify 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 Window.

  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 Command or APPEND Command. For query, program, and other text files already on your computer, you can change the code page using the MODIFY QUERY Command, MODIFY COMMAND Command, and MODIFY FILE Command.

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, Visual FoxPro doesn't support some code page translations. Always check the results of a code page change to be sure that your data has been translated successfully.

See Also

Tasks

How to: Specify the Code Page of a .dbf File
How to: Determine the Code Page of a Project File
How to: Prevent Translation of Data in Character or Memo Fields

Concepts

Specification of Code Pages for Variables

Other Resources

Code Pages in Visual FoxPro
Developing International Applications