CLion 2020.2 Help

File encoding

You can configure and change encoding for directories or files including the properties files.

CLion lets you change encoding while you work in the editor. If you need to check encoding details and configure more options, use the Editor | Files Encodings page in the Settings/Preferences dialog Ctrl+Alt+S .

Configure encoding for a directory or a file without built-in encoding information

  1. In the Settings/Preferences dialog Ctrl+Alt+S, click File Encodings under Editor. The File Encodings page opens.

  2. The Path column shows a path to a file or a directory. The Encoding column shows the encodings. Click the specified encoding to change it. You can also add a new path, delete, or edit the existing one.

Change encoding of a file that contains explicit encoding

  1. Open the desired file in the editor.

  2. Change explicit encoding information. Use error highlighting to recognize wrong encoding and press Ctrl+Space to have a list of available encodings displayed:

    Explicit encoding

Change encoding of a single file that doesn't contain explicit encoding

  1. Open the desired file for editing.

  2. From the main menu, select File | File encoding or click the file encoding on the status bar.

  3. Select the desired encoding from the popup.

    Status bar encoding
  4. If The triangle warning icon or The round warning icon is displayed next to the selected encoding, it means that this encoding might change the file contents. In this case CLion opens a dialog where you can decide what you want to do with the file: choose Reload to load the file in the editor from disk and apply encoding changes to the editor only, or choose Convert to overwrite the file with the encoding of your choice.

Console output encoding

CLion creates files using the IDE encoding defined in the File Encodings page of the Settings / Preferences dialog Ctrl+Alt+S. You can use either the system default or select from the list of available encodings. By default, this encoding affects console output. If you want the encoding for console output to be different from the global IDE settings, configure the corresponding JVM option:

  1. On the Help menu, click Edit Custom VM Options.

  2. Add the -Dconsole.encoding option and set the value to the necessary encoding. For example: -Dconsole.encoding=UTF-8

  3. Restart CLion.

For more information, see JVM options.

Last modified: 19 August 2020