Internet Message Access Protocol Internationalization
Extracted elements (27)
I18NLEVEL=1 is a simpler version of I18NLEVEL=2 with no ability to select a different collation; it mandates i;unicode-casemap as the fixed comparator. I18NLEVEL=2 is a superset adding comparator negotiation via the COMPARATOR command, enabling locale-appropriate sorting.
IMAP human-readable text is limited to US-ASCII in RFC 3501 to preserve backwards compatibility. The LANGUAGE extension is designed as an opt-in negotiation so that only clients that explicitly request localization receive non-ASCII responses, avoiding breakage of deployed implementations.
The modified UTF-7 mailbox naming convention (RFC 3501 Section 5.1.3) is described as a transitional measure from 1996 when local character sets such as ISO-8859-1 and Shift-JIS were in unofficial use for mailbox names, causing non-interoperability. Full UTF-8 mailbox names are a future goal.
Several server implementations deployed before this specification comply with I18NLEVEL=1 but do not advertise it; others use i;ascii-casemap. There is no reliable way for a client to determine which comparator a legacy server uses, potentially forcing expensive local operations.
The IMAP LOGIN command userid and password fields are restricted to US-ASCII until a future standards-track RFC states otherwise. Servers are encouraged to validate both fields as valid UTF-8 and MAY reject LOGIN if either field contains an octet with the high bit set.
A server advertising I18NLEVEL=2 MUST list I18NLEVEL=2 in its CAPABILITY data in authenticated state and MUST implement i;unicode-casemap. The default comparator MUST remain static for the remainder of a connection once the authenticated state is entered.
A server advertising the LANGUAGE extension MUST use the language 'i-default' as its default language until another supported language is negotiated, and MUST include 'i-default' as one of its supported languages.
A server that advertises I18NLEVEL=1 or I18NLEVEL=2 MUST implement the i;unicode-casemap comparator and MUST support UTF-8 as a SEARCH charset.
An IMAP server satisfying I18NLEVEL=1 requirements MUST list the keyword I18NLEVEL=1 in its CAPABILITY data once IMAP enters authenticated state.
Clients and servers that support the LANGUAGE extension MUST also support the NAMESPACE extension (RFC 2342).
Clients SHOULD issue the LANGUAGE command before authentication, since some servers send valuable user information during authentication. If a security layer is subsequently negotiated, the client MUST re-issue LANGUAGE to prevent active attack effects on subsequent error messages.
If a language range does not match a known language tag exactly but matches by the rules of RFC 4647, the server MUST send an untagged LANGUAGE response indicating the language selected.
If the active collation does not provide the operations needed by an IMAP command (e.g., substring for SEARCH, ordering for SORT), the server MUST respond with a tagged BAD.
If the LANGUAGE command succeeds, the server MUST send a LANGUAGE response specifying the language used, and responses will be in UTF-8. The change takes effect immediately after the LANGUAGE response.
IMAP servers that support the LANGUAGE extension MUST list the keyword LANGUAGE in their CAPABILITY response as well as in the greeting CAPABILITY data.
When performing collation, MIME encoding MUST be removed from texts being collated (step a), and the decoded text MUST be converted to the charset expected by the active comparator (step b). Failures at step b fall back to i;octet comparator.
The active comparator applies to SEARCH keys BCC, BODY, CC, FROM, SUBJECT, TEXT, TO, and HEADER; to SORT keys CC, FROM, SUBJECT, and TO; and to ORDEREDSUBJECT and REFERENCES threading algorithms.
The BADCOMPARATOR response code SHOULD be returned when the server fails an IMAP command with NO because none of the specified comparators match any requested comparator.
The COMPARATOR command (valid in authenticated and selected states) determines or changes the active comparator. With no arguments it returns the current active comparator; with arguments it changes the active comparator, with the first matching argument winning.
The COMPARATOR response returns the name of the active comparator as the first argument, and optionally a list of all comparators matching the COMPARATOR command arguments as the second argument (present only when more than one match is found).
The LANGUAGE command requests that human-readable text emitted by the server be localized to a language matching one of the language range arguments as described by RFC 4647 Section 2. It is valid in all states.
The LANGUAGE response contains a list of one or more language tags. A single-tag response indicates the server is now using that language; a multi-tag response communicates a list of available languages with no change to the active language.
The TRANSLATION extension to the NAMESPACE response returns a single modified UTF-7 encoded string containing the localized translation of a namespace prefix. The client is responsible for converting between the prefix and its translation when presenting mailbox names.
IANA added LANGUAGE, I18NLEVEL=1, and I18NLEVEL=2 to the IMAP4 Capabilities Registry as defined by this specification.
A LANGUAGE command issued before a security layer is active is subject to active attack that suppresses or modifies the negotiation, making STARTTLS or authentication error messages harder to interpret. Clients MUST re-issue LANGUAGE after a security layer is activated.
The LANGUAGE extension makes a new command available in 'Not Authenticated' state. Implementations running with root privilege in this state are particularly vulnerable to buffer overflow errors and must parse the LANGUAGE command with extra care.
The namespace-trans production adds 'SP DQUOTE "TRANSLATION" DQUOTE SP "(" string ")"' to namespace responses, where the string is encoded in modified UTF-7. The resp-text rule is replaced after language change to allow UTF8-TEXT-CHAR (UTF-8 excluding 7-bit control characters and "[").