GoLand
 
Get GoLand
You are viewing the documentation for an earlier version of GoLand.

Encoding

Last modified: 23 August 2023

To display and edit files correctly, GoLand 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, GoLand uses the following steps:

  • If the byte order mark (BOM) is present, GoLand 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, GoLand 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, GoLand 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, GoLand will use the encoding of the parent directory. If the parent directory encoding is also not configured, GoLand will fall back to the Project Encoding, and if there is no project, to Global Encoding.