Character set encoding of the file

Desktop entry files are encoded as lines of 8-bit characters separated by LF characters.

Except for comments and values of type localestring, only ASCII characters are permitted in the file:

Comment lines are uninterpreted and may contain any character (except for LF). However, using UTF-8 for comment lines that contain characters not in ASCII is encouraged.

The encoding for values of type localestring is determined by the Encoding field of the desktop entry. This field should always be present. (However, many legacy files may not include it.)

Only two values for Encoding are currently defined: 'UTF-8', and 'Legacy-Mixed', and desktop files must not use any other value. Implementations must support the UTF-8 encoding, and may choose to support Legacy-Mixed in addition. For this reason, authors of desktop files are encouraged to use the value 'UTF-8'.

If the file specifies an unsupported encoding, the implementation should either ignore the file, or, if the user has requested a direct operation on the file (such as opening it for editing), display an appropriate error indication to the user.

In the absence of an Encoding line, the implementation may choose to autodetect the encoding of the file by using such factors as:

If the implementation does not perform such auto-detection, it should treat a file without an Encoding key in the same way as a file with an unsupported Encoding Key.