Character set encoding of the file

Desktop Entry Standard
Prev |  | Next

# 5. 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:

- Key names must contain only the characters 'A-Za-z0-9-'

- Group names may contain all ASCII characters except for control characters and '[' and ']'.

- Values of type string may contain all ASCII characters except for control characters.

- Values of type boolean must either be the string 'true' or 'false'

- Numeric values must be a valid floating point number as recognized by the %f specifier for scanf.

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:

- The location of the file on the filesystem

- Whether the contents of the file are valid UTF-8

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.

Prev | Home | Next
Recognized desktop entry keys |  | List of valid Exec parameter variables