Managing Files with Encoding

To facilitate the display of your code in a particular language and on a particular platform, you can associate a particular character encoding with a file.

If you are using Visual SourceSafe to store files with ANSI, UTF8 or Unicode, be aware of the following limitations for each.

  • ANSI files allow only characters that are supported in the current code page, which limits international use.
  • Unicode files work cannot use shared checkout, difference checking or merging functionality because they are handled as binary files. You can use this format in international files.
  • UTF8 files do not work safely with Visual SourceSafe because changes are made during check-in, check-out, difference checking, and merging that cause problems for UTF8 file editors.

Opening Files

You can choose the editor you want to use to edit the file. The list of editors available when you are opening the file depends upon the type of file you are attempting to open or create.

To open a file with a specific codepage

  1. On the File menu, select Open and then select File.

  2. In the Open File dialog box, select the file name.

  3. Choose the arrow adjacent to the Open button, and then select Open With.

  4. On the Select a program to open list, select an encoding option, and then choose Open.

    To open the file with a particular encoding, select an editor with encoding support, such as Source Code (Text) with Encoding or HTML/XML Editor with Encoding.

You can open a file with a different encoding or in a different code editor.

To open a file in an alternative editor or Unicode encoding

  1. On the File menu, choose Open and then select File.

  2. In the Open File dialog box, click the arrow adjacent to the Open button and click Open With.

  3. From the list in the Open With dialog box, select the editor into which you want to open the file, such as the Binary or Resource editor.

    To open the file with a particular encoding, select an editor with encoding support, such as Source Code (Text) with Encoding or HTML/XML Editor with Encoding.

Saving Files

You can also save your code with a Unicode encoding or a different code page to support various languages, such as Western European or Eastern European. You can associate a particular character encoding with a file to facilitate the display of your code in that language, as well as a line ending type to support a particular operating system. Also, some characters, when used in filenames, cannot be saved unless they are saved with Unicode encoding.

To save a file with a different encoding or line ending type

  1. On the File menu, click Advanced Save Options.

  2. In the Advanced Save Options dialog box, select the encoding you want from the Encoding list.

  3. From the Line Endings list, select the type of line ending you want.

    Note   If you save your file your file with a Unicode encoding, the file should be checked into Visual SourceSafe as a binary file because Visual SourceSafe does not support merging or comparing and showing differences between files that are saved as Unicode.

See Also

Managing Files in an International Application | Encoding Dialog Box | Advanced Save Options Dialog Box | Editing Code, HTML, and Text | Globalization and Localization Issues | International Projects in Visual Studio .NET