Saving and Opening Files with Encoding
You can save files with specific character encoding to support bi-directional languages. You can also specify an encoding when opening a file, so that Visual Studio displays the file correctly.
To save a file with encoding
- From the File menu, choose Save File As, and then click the drop-down button next to the Save button.
The Advanced Save Options dialog box is displayed.
- Under Encoding, select the encoding to use for the file.
- Optionally, under Line endings, select the format for end-of-line characters.
This option is useful if you intend to exchange the file with users of a different operating system.
If you want to work with a file that you know is encoded in a specific way, you can tell Visual Studio to use that encoding when opening the file. The method you use depends on whether the file is part of your project.
To open an encoded file that is part of a project
- In Solution Explorer, right-click the file and choose Open With.
- In the Open With dialog box, choose the editor to open the file with.
Many Visual Studio editors, such as the forms editor, will auto-detect the encoding and open the file appropriately. If you choose an editor that allows you to choose an encoding, the Encoding dialog box is displayed.
- In the Encoding dialog box, select the encoding that the editor should use.
To open an encoded file that is not part of a project
- On the File menu, point to Open, choose File or File From Web, and then select the file to open.
- Click the drop-down button next to the Open button and choose Open With.
- Follow Steps 2 and 3 from the preceding procedure.