JetBrains Rider 2022.2 Help

Encoding

To display and edit files correctly, JetBrains Rider needs to know which encoding to use. In general, source code files are mostly in UTF-8. This is the recommended encoding unless you have some other requirements.

To determine the encoding of a file, JetBrains Rider uses the following steps:

  • If the byte order mark (BOM) is present, JetBrains Rider will use the corresponding Unicode encoding regardless of all other settings. For more information, see Byte order mark.

  • If the file declares the encoding explicitly, JetBrains Rider will use the specified encoding. For example, this can apply to XML, HTML, and JSP files. The explicit declaration also overrides all other settings, but you can change it in the editor.

  • If there is no BOM and no explicit encoding declaration in the file, JetBrains Rider will use the encoding configured for the file or directory in the file encoding settings. If encoding is not configured for the file or directory, JetBrains Rider will use the encoding of the parent directory. If the parent directory encoding is also not configured, JetBrains Rider will fall back to the Project Encoding, and if there is no project, to Global Encoding.

Change the encoding used to view a file

If JetBrains Rider displays characters in a file incorrectly, it probably couldn't detect the file encoding. In this case, you need to specify the correct encoding to use for viewing and editing this file.

  • With the file open in the editor, either select File | File Properties | File Encoding from the main menu or click the File Encoding widget on the status bar, and select the correct encoding of the file.

    Status bar encoding

    Encodings marked with The triangle warning icon or The round error icon might change the file contents. In this case, JetBrains Rider opens a dialog where you can choose what to do with the file:

    • Reload: load the file in the editor from disk and apply encoding changes to the editor only. You will see the content changes related to the chosen encoding, but the actual file will not change.

    • Convert: overwrite the file with the chosen encoding.

This will add an association for the file to the file encoding settings. JetBrains Rider will use the specified encoding to view and edit this file.

Configure file encoding settings

  • Press Ctrl+Alt+S to open the IDE settings and select Editor | File Encoding.

JetBrains Rider uses these settings to view and edit files for which it was unable to detect the encoding and uses the specified encodings for new files. For more information, see File Encodings.

Select console output encoding

By default, JetBrains Rider uses the system encoding to view console output.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Editor | General | Console.

  2. Select the default encoding from the Default Encoding list.

  3. Click OK to apply the changes.

For more information about console output settings, see Console.

Last modified: 01 November 2022