rfc5255.IMAP_i18n.txt 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. Network Working Group C. Newman
  2. Request for Comments: 5255 Sun Microsystems
  3. Category: Standards Track A. Gulbrandsen
  4. Oryx Mail Systems GmhH
  5. A. Melnikov
  6. Isode Limited
  7. June 2008
  8. Internet Message Access Protocol Internationalization
  9. Status of This Memo
  10. This document specifies an Internet standards track protocol for the
  11. Internet community, and requests discussion and suggestions for
  12. improvements. Please refer to the current edition of the "Internet
  13. Official Protocol Standards" (STD 1) for the standardization state
  14. and status of this protocol. Distribution of this memo is unlimited.
  15. Abstract
  16. Internet Message Access Protocol (IMAP) version 4rev1 has basic
  17. support for non-ASCII characters in mailbox names and search
  18. substrings. It also supports non-ASCII message headers and content
  19. encoded as specified by Multipurpose Internet Mail Extensions (MIME).
  20. This specification defines a collection of IMAP extensions that
  21. improve international support including language negotiation for
  22. international error text, translations for namespace prefixes, and
  23. comparator negotiation for search, sort, and thread.
  24. Newman, et al. Standards Track [Page 1]
  25. RFC 5255 IMAP Internationalization June 2008
  26. Table of Contents
  27. 1. Introduction ....................................................3
  28. 2. Conventions Used in This Document ...............................3
  29. 3. LANGUAGE Extension ..............................................3
  30. 3.1. LANGUAGE Extension Requirements ............................4
  31. 3.2. LANGUAGE Command ...........................................4
  32. 3.3. LANGUAGE Response ..........................................6
  33. 3.4. TRANSLATION Extension to the NAMESPACE Response ............7
  34. 3.5. Formal Syntax ..............................................8
  35. 4. I18NLEVEL=1 and I18NLEVEL=2 Extensions ..........................9
  36. 4.1. Introduction and Overview ..................................9
  37. 4.2. Requirements Common to Both I18NLEVEL=1 and I18NLEVEL=2 ....9
  38. 4.3. I18NLEVEL=1 Extension Requirements ........................10
  39. 4.4. I18NLEVEL=2 Extension Requirements ........................10
  40. 4.5. Compatibility Notes .......................................11
  41. 4.6. Comparators and Character Encodings .......................11
  42. 4.7. COMPARATOR Command ........................................13
  43. 4.8. COMPARATOR Response .......................................14
  44. 4.9. BADCOMPARATOR Response Code ...............................14
  45. 4.10. Formal Syntax ............................................14
  46. 5. Other IMAP Internationalization Issues .........................15
  47. 5.1. Unicode Userids and Passwords .............................15
  48. 5.2. UTF-8 Mailbox Names .......................................15
  49. 5.3. UTF-8 Domains, Addresses, and Mail Headers ................15
  50. 6. IANA Considerations ............................................16
  51. 7. Security Considerations ........................................16
  52. 8. Acknowledgements ...............................................16
  53. 9. Relevant Sources of Documents for Internationalized IMAP
  54. Implementations ................................................17
  55. 10. Normative References ..........................................17
  56. 11. Informative References ........................................18
  57. Newman, et al. Standards Track [Page 2]
  58. RFC 5255 IMAP Internationalization June 2008
  59. 1. Introduction
  60. This specification defines two IMAP4rev1 [RFC3501] extensions to
  61. enhance international support. These extensions can be advertised
  62. and implemented separately.
  63. The LANGUAGE extension allows the client to request a suitable
  64. language for protocol error messages and in combination with the
  65. NAMESPACE extension [RFC2342] enables namespace translations.
  66. The I18NLEVEL=2 extension allows the client to request a suitable
  67. collation that will modify the behavior of the base specification's
  68. SEARCH command as well as the SORT and THREAD extensions [SORT].
  69. This leverages the collation registry [RFC4790]. The I18NLEVEL=1
  70. extension updates SEARCH/SORT/THREAD to use i;unicode-casemap
  71. comparator, as defined in [UCM]. I18NLEVEL=1 is a simpler version of
  72. I18NLEVEL=2 with no ability to select a different collation.
  73. 2. Conventions Used in This Document
  74. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  75. "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
  76. document are to be interpreted as described in [RFC2119].
  77. The formal syntax uses the Augmented Backus-Naur Form (ABNF)
  78. [RFC5234] notation including the core rules defined in Appendix A.
  79. The UTF-8-related productions are defined in [RFC3629].
  80. In examples, "C:" and "S:" indicate lines sent by the client and
  81. server respectively. If a single "C:" or "S:" label applies to
  82. multiple lines, then the line breaks between those lines are for
  83. editorial clarity only and are not part of the actual protocol
  84. exchange.
  85. 3. LANGUAGE Extension
  86. IMAP allows server responses to include human-readable text that in
  87. many cases needs to be presented to the user. But that text is
  88. limited to US-ASCII by the IMAP specification [RFC3501] in order to
  89. preserve backwards compatibility with deployed IMAP implementations.
  90. This section specifies a way for an IMAP client to negotiate which
  91. language the server should use when sending human-readable text.
  92. Newman, et al. Standards Track [Page 3]
  93. RFC 5255 IMAP Internationalization June 2008
  94. The LANGUAGE extension only provides a mechanism for altering fixed
  95. server strings such as response text and NAMESPACE folder names.
  96. Assigning localized language aliases to shared mailboxes would be
  97. done with a separate mechanism such as the proposed METADATA
  98. extension (see [METADATA]).
  99. 3.1. LANGUAGE Extension Requirements
  100. IMAP servers that support this extension MUST list the keyword
  101. LANGUAGE in their CAPABILITY response as well as in the greeting
  102. CAPABILITY data.
  103. A server that advertises this extension MUST use the language
  104. "i-default" as described in [RFC2277] as its default language until
  105. another supported language is negotiated by the client. A server
  106. MUST include "i-default" as one of its supported languages. IMAP
  107. servers SHOULD NOT advertise the LANGUAGE extension if they discover
  108. that they only support "i-default".
  109. Clients and servers that support this extension MUST also support the
  110. NAMESPACE extension [RFC2342].
  111. The LANGUAGE command is valid in all states. Clients SHOULD issue
  112. LANGUAGE before authentication, since some servers send valuable user
  113. information as part of authentication (e.g., "password is correct,
  114. but expired"). If a security layer (such as SASL or TLS) is
  115. subsequently negotiated by the client, it MUST re-issue the LANGUAGE
  116. command in order to make sure that no previous active attack (if any)
  117. on LANGUAGE negotiation has effect on subsequent error messages.
  118. (See Section 7 for a more detailed explanation of the attack.)
  119. 3.2. LANGUAGE Command
  120. Arguments: Optional language range arguments.
  121. Response: A possible LANGUAGE response (see Section 3.3).
  122. A possible NAMESPACE response (see Section 3.4).
  123. Result: OK - Command completed
  124. NO - Could not complete command
  125. BAD - Arguments invalid
  126. The LANGUAGE command requests that human-readable text emitted by the
  127. server be localized to a language matching one of the language range
  128. argument as described by Section 2 of [RFC4647].
  129. Newman, et al. Standards Track [Page 4]
  130. RFC 5255 IMAP Internationalization June 2008
  131. If the command succeeds, the server will return human-readable
  132. responses in the first supported language specified. These responses
  133. will be in UTF-8 [RFC3629]. The server MUST send a LANGUAGE response
  134. specifying the language used, and the change takes effect immediately
  135. after the LANGUAGE response.
  136. If the command fails, the server continues to return human-readable
  137. responses in the language it was previously using.
  138. The special "default" language range argument indicates a request to
  139. use a language designated as preferred by the server administrator.
  140. The preferred language MAY vary based on the currently active user.
  141. If a language range does not match a known language tag exactly but
  142. does match a language by the rules of [RFC4647], the server MUST send
  143. an untagged LANGUAGE response indicating the language selected.
  144. If there aren't any arguments, the server SHOULD send an untagged
  145. LANGUAGE response listing the languages it supports. If the server
  146. is unable to enumerate the list of languages it supports it MAY
  147. return a tagged NO response to the enumeration request. If, after
  148. receiving a LANGUAGE request, the server discovers that it doesn't
  149. support any language other than i-default, it MUST return a tagged NO
  150. response to the enumeration request.
  151. < The server defaults to using English i-default responses until
  152. the user explicitly changes the language. >
  153. C: A001 LOGIN KAREN PASSWORD
  154. S: A001 OK LOGIN completed
  155. < Client requested MUL language, which no server supports. >
  156. C: A002 LANGUAGE MUL
  157. S: A002 NO Unsupported language MUL
  158. < A LANGUAGE command with no arguments is a request to enumerate
  159. the list of languages the server supports. >
  160. C: A003 LANGUAGE
  161. S: * LANGUAGE (EN DE IT i-default)
  162. S: A003 OK Supported languages have been enumerated
  163. C: B001 LANGUAGE
  164. S: B001 NO Server is unable to enumerate supported languages
  165. Newman, et al. Standards Track [Page 5]
  166. RFC 5255 IMAP Internationalization June 2008
  167. < Once the client changes the language, all responses will be in
  168. that language starting after the LANGUAGE response. Note that
  169. this includes the NAMESPACE response. Because RFCs are in US-
  170. ASCII, this document uses an ASCII transcription rather than
  171. UTF-8 text, e.g., "ue" in the word "ausgefuehrt" >
  172. C: C001 LANGUAGE DE
  173. S: * LANGUAGE (DE)
  174. S: * NAMESPACE (("" "/")) (("Other Users/" "/" "TRANSLATION"
  175. ("Andere Ben&APw-tzer/"))) (("Public Folders/" "/"
  176. "TRANSLATION" ("Gemeinsame Postf&AM8-cher/")))
  177. S: C001 OK Sprachwechsel durch LANGUAGE-Befehl ausgefuehrt
  178. < If a server does not support the requested primary language,
  179. responses will continue to be returned in the current language
  180. the server is using. >
  181. C: D001 LANGUAGE FR
  182. S: D001 NO Diese Sprache ist nicht unterstuetzt
  183. C: D002 LANGUAGE DE-IT
  184. S: * LANGUAGE (DE-IT)
  185. S: * NAMESPACE (("" "/"))(("Other Users/" "/" "TRANSLATION"
  186. ("Andere Ben&APw-tzer/"))) (("Public Folders/" "/"
  187. "TRANSLATION" ("Gemeinsame Postf&AM8-cher/")))
  188. S: D002 OK Sprachwechsel durch LANGUAGE-Befehl ausgefuehrt
  189. C: D003 LANGUAGE "default"
  190. S: * LANGUAGE (DE)
  191. S: D003 OK Sprachwechsel durch LANGUAGE-Befehl ausgefuehrt
  192. < Server does not speak French, but does speak English. User
  193. speaks Canadian French and Canadian English. >
  194. C: E001 LANGUAGE FR-CA EN-CA
  195. S: * LANGUAGE (EN)
  196. S: E001 OK Now speaking English
  197. 3.3. LANGUAGE Response
  198. Contents: A list of one or more language tags.
  199. The LANGUAGE response occurs as a result of a LANGUAGE command. A
  200. LANGUAGE response with a list containing a single language tag
  201. indicates that the server is now using that language. A LANGUAGE
  202. response with a list containing multiple language tags indicates the
  203. server is communicating a list of available languages to the client,
  204. and no change in the active language has been made.
  205. Newman, et al. Standards Track [Page 6]
  206. RFC 5255 IMAP Internationalization June 2008
  207. 3.4. TRANSLATION Extension to the NAMESPACE Response
  208. If localized representations of the namespace prefixes are available
  209. in the selected language, the server SHOULD include these in the
  210. TRANSLATION extension to the NAMESPACE response.
  211. The TRANSLATION extension to the NAMESPACE response returns a single
  212. string, containing the modified UTF-7 [RFC3501] encoded translation
  213. of the namespace prefix. It is the responsibility of the client to
  214. convert between the namespace prefix and the translation of the
  215. namespace prefix when presenting mailbox names to the user.
  216. In this example, a server supports the IMAP4 NAMESPACE command. It
  217. uses no prefix to the user's Personal Namespace, a prefix of "Other
  218. Users" to its Other Users' Namespace, and a prefix of "Public
  219. Folders" to its only Shared Namespace. Since a client will often
  220. display these prefixes to the user, the server includes a translation
  221. of them that can be presented to the user.
  222. C: A001 LANGUAGE DE-IT
  223. S: * NAMESPACE (("" "/")) (("Other Users/" "/" "TRANSLATION"
  224. ("Andere Ben&APw-tzer/"))) (("Public Folders/" "/"
  225. "TRANSLATION" ("Gemeinsame Postf&AM8-cher/")))
  226. S: A001 OK LANGUAGE-Befehl ausgefuehrt
  227. Newman, et al. Standards Track [Page 7]
  228. RFC 5255 IMAP Internationalization June 2008
  229. 3.5. Formal Syntax
  230. The following syntax specification inherits ABNF [RFC5234] rules from
  231. IMAP4rev1 [RFC3501], IMAP4 Namespace [RFC2342], Tags for the
  232. Identifying Languages [RFC4646], UTF-8 [RFC3629], and Collected
  233. Extensions to IMAP4 ABNF [RFC4466].
  234. command-any =/ language-cmd
  235. ; LANGUAGE command is valid in all states
  236. language-cmd = "LANGUAGE" *(SP lang-range-quoted)
  237. response-payload =/ language-data
  238. language-data = "LANGUAGE" SP "(" lang-tag-quoted *(SP
  239. lang-tag-quoted) ")"
  240. namespace-trans = SP DQUOTE "TRANSLATION" DQUOTE SP "(" string ")"
  241. ; the string is encoded in Modified UTF-7.
  242. ; this is a subset of the syntax permitted by
  243. ; the Namespace-Response-Extension rule in [RFC4466]
  244. lang-range-quoted = astring
  245. ; Once any literal wrapper or quoting is removed, this
  246. ; follows the language-range rule in [RFC4647]
  247. lang-tag-quoted = astring
  248. ; Once any literal wrapper or quoting is removed, this follows
  249. ; the Language-Tag rule in [RFC4646]
  250. resp-text = ["[" resp-text-code "]" SP ] UTF8-TEXT-CHAR
  251. *(UTF8-TEXT-CHAR / "[")
  252. ; After the server is changed to a language other than
  253. ; i-default, this resp-text rule replaces the resp-text
  254. ; rule from [RFC3501].
  255. UTF8-TEXT-CHAR = %x20-5A / %x5C-7E / UTF8-2 / UTF8-3 / UTF8-4
  256. ; UTF-8 excluding 7-bit control characters and "["
  257. Newman, et al. Standards Track [Page 8]
  258. RFC 5255 IMAP Internationalization June 2008
  259. 4. I18NLEVEL=1 and I18NLEVEL=2 Extensions
  260. 4.1. Introduction and Overview
  261. IMAP4rev1 [RFC3501] includes the SEARCH command that can be used to
  262. locate messages matching criteria including human-readable text. The
  263. SORT extension [SORT] to IMAP allows the client to ask the server to
  264. determine the order of messages based on criteria including human-
  265. readable text. These mechanisms require the ability to support non-
  266. English search and sort functions.
  267. Section 4 defines two IMAP extensions for internationalizing IMAP
  268. SEARCH, SORT, and THREAD [SORT] using the comparator framework
  269. [RFC4790].
  270. The I18NLEVEL=1 extension updates SEARCH/SORT/THREAD to use
  271. i;unicode-casemap comparator, as defined in [UCM]. See Sections 4.2
  272. and 4.3 for more details.
  273. The I18NLEVEL=2 extension is a superset of the I18NLEVEL=1 extension.
  274. It adds to I18NLEVEL=1 extension the ability to determine the active
  275. comparator (see definition below) and to negotiate use of comparators
  276. using the COMPARATOR command. It also adds the COMPARATOR response
  277. that indicates the active comparator and possibly other available
  278. comparators. See Sections 4.2 and 4.4 for more details.
  279. 4.2. Requirements Common to Both I18NLEVEL=1 and I18NLEVEL=2
  280. The term "default comparator" refers to the comparator that is used
  281. by SEARCH and SORT absent any negotiation using the COMPARATOR
  282. command (see Section 4.7). The term "active comparator" refers to
  283. the comparator which will be used within a session, e.g., by SEARCH
  284. and SORT. The COMPARATOR command is used to change the active
  285. comparator.
  286. The active comparator applies to the following SEARCH keys: "BCC",
  287. "BODY", "CC", "FROM", "SUBJECT", "TEXT", "TO", and "HEADER". If the
  288. server also advertises the "SORT" extension, then the active
  289. comparator applies to the following SORT keys: "CC", "FROM",
  290. "SUBJECT", and "TO". If the server advertises THREAD=ORDEREDSUBJECT,
  291. then the active comparator applies to the ORDEREDSUBJECT threading
  292. algorithm. If the server advertises THREAD=REFERENCES, then the
  293. active comparator applies to the subject field comparisons done by
  294. REFERENCES threading algorithm. Future extensions may choose to
  295. apply the active comparator to their SEARCH keys.
  296. Newman, et al. Standards Track [Page 9]
  297. RFC 5255 IMAP Internationalization June 2008
  298. For SORT and THREAD, the pre-processing necessary to extract the base
  299. subject text from a Subject header occurs prior to the application of
  300. a comparator.
  301. A server that advertises I18NLEVEL=1 or I18NLEVEL=2 extension MUST
  302. implement the i;unicode-casemap comparator, as defined in [UCM].
  303. A server that advertises I18NLEVEL=1 or I18NLEVEL=2 extension MUST
  304. support UTF-8 as a SEARCH charset.
  305. 4.3. I18NLEVEL=1 Extension Requirements
  306. An IMAP server that satisfies all requirements specified in Sections
  307. 4.2 and 4.6 (and that doesn't support/advertise any other
  308. I18NLEVEL=<n> extension, where n > 1) MUST list the keyword
  309. I18NLEVEL=1 in its CAPABILITY data once IMAP enters the authenticated
  310. state, and MAY list that keyword in other states.
  311. 4.4. I18NLEVEL=2 Extension Requirements
  312. An IMAP server that satisfies all requirements specified in Sections
  313. 4.2, 4.4, and 4.6-4.10 (and that doesn't support/advertise any other
  314. I18NLEVEL=<n> extension, where n > 2) MUST list the keyword
  315. I18NLEVEL=2 in its CAPABILITY data once IMAP enters the authenticated
  316. state, and MAY list that keyword in other states.
  317. A server that advertises this extension MUST implement the
  318. i;unicode-casemap comparator, as defined in [UCM]. It MAY implement
  319. other comparators from the IANA registry established by [RFC4790].
  320. See also Section 4.5 of this document.
  321. A server that advertises this extension SHOULD use i;unicode-casemap
  322. as the default comparator. (Note that i;unicode-casemap is the
  323. default comparator for I18NLEVEL=1, but not necessarily the default
  324. for I18NLEVEL=2.) The selection of the default comparator MAY be
  325. adjustable by the server administrator, and MAY be sensitive to the
  326. current user. Once the IMAP connection enters authenticated state,
  327. the default comparator MUST remain static for the remainder of that
  328. connection.
  329. Note that since SEARCH uses the substring operation, IMAP servers can
  330. only implement collations that offer the substring operation (see
  331. [RFC4790], Section 4.2.2). Since SORT uses the ordering operation
  332. (which in turn uses the equality operation), IMAP servers that
  333. advertise the SORT extension can only implement collations that offer
  334. all three operations (see [RFC4790], Sections 4.2.2-4.2.4).
  335. Newman, et al. Standards Track [Page 10]
  336. RFC 5255 IMAP Internationalization June 2008
  337. If the active collation does not provide the operations needed by an
  338. IMAP command, the server MUST respond with a tagged BAD.
  339. 4.5. Compatibility Notes
  340. Several server implementations deployed prior to the publication of
  341. this specification comply with I18NLEVEL=1 (see Section 4.3), but do
  342. not advertise that. Other legacy servers use the i;ascii-casemap
  343. comparator (see [RFC4790]).
  344. There is no good way for a client to know which comparator a legacy
  345. server uses. If the client has to assume the worst, it may end up
  346. doing expensive local operations to obtain i;unicode-casemap
  347. comparisons even though the server implements it.
  348. Legacy server implementations which comply with I18NLEVEL=1 should be
  349. updated to advertise I18NLEVEL=1. All server implementations should
  350. eventually be updated to comply with the I18NLEVEL=2 extension.
  351. 4.6. Comparators and Character Encodings
  352. RFC 3501, Section 6.4.4, says:
  353. In all search keys that use strings, a message matches the key
  354. if the string is a substring of the field. The matching is
  355. case-insensitive.
  356. When performing the SEARCH operation, the active comparator is
  357. applied instead of the case-insensitive matching specified above.
  358. An IMAP server which performs collation operations (e.g., as part of
  359. commands such as SEARCH, SORT, and THREAD) does so according to the
  360. following procedure:
  361. (a) MIME encoding (for example, see [RFC2047] for headers and
  362. [RFC2045] for body parts) MUST be removed in the texts being
  363. collated.
  364. If MIME encoding removal fails for a message (e.g., a body part
  365. of the message has an unsupported Content-Transfer-Encoding, uses
  366. characters not allowed by the Content-Transfer-Encoding, etc.),
  367. the collation of this message is undefined by this specification,
  368. and is handled in an implementation-dependent manner.
  369. (b) The decoded text from (a) MUST be converted to the charset
  370. expected by the active comparator.
  371. Newman, et al. Standards Track [Page 11]
  372. RFC 5255 IMAP Internationalization June 2008
  373. (c) For the substring operation:
  374. If step (b) failed (e.g., the text is in an unknown charset,
  375. contains a sequence that is not valid according in that charset,
  376. etc.), the original decoded text from (a) (i.e., before the
  377. charset conversion attempt) is collated using the i;octet
  378. comparator (see [RFC4790]).
  379. If step (b) was successful, the converted text from (b) is
  380. collated according to the active comparator.
  381. For the ordering operation:
  382. All strings that were successfully converted by step (b) are
  383. separated from all strings that failed step (b). Strings in each
  384. group are collated independently. All strings successfully
  385. converted by step (b) are then validated by the active
  386. comparator. Strings that pass validation are collated using the
  387. active comparator. All strings that either fail step (b) or fail
  388. the active collation's validity operation are collated (after
  389. applying step (a)) using the i;octet comparator (see [RFC4790]).
  390. The resulting sorted list is produced by appending all collated
  391. "failed" strings after all strings collated using the active
  392. comparator.
  393. Example: The following example demonstrates ordering of 4
  394. different strings using the i;unicode-casemap [UCM] comparator.
  395. Strings are represented using hexadecimal notation used by ABNF
  396. [RFC5234].
  397. (1) %xD0 %xC0 %xD0 %xBD %xD0 %xB4 %xD1 %x80 %xD0 %xB5
  398. %xD0 %xB9 (labeled with charset=UTF-8)
  399. (2) %xD1 %x81 %xD0 %x95 %xD0 %xA0 %xD0 %x93 %xD0 %x95
  400. %xD0 %x99 (labeled with charset=UTF-8)
  401. (3) %xD0 %x92 %xD0 %xB0 %xD1 %x81 %xD0 %xB8 %xD0 %xBB
  402. %xD0 %xB8 %xFF %xB9 (labeled with charset=UTF-8)
  403. (4) %xE1 %xCC %xC5 %xCB %xD3 %xC5 %xCA (labeled with
  404. charset=KOI8-R)
  405. Step (b) will convert string (4) to the following sequence of
  406. octets (in UTF-8):
  407. %xD0 %x90 %xD0 %xBB %xD0 %xB5 %xD0 %xBA %xD1 %x81 %xD0
  408. %xB5 %xD0 %xB9
  409. and will reject strings (1) and (3), as they contain octets not
  410. allowed in charset=UTF-8.
  411. Newman, et al. Standards Track [Page 12]
  412. RFC 5255 IMAP Internationalization June 2008
  413. After that, using the i;unicode-casemap collation, string (4)
  414. will collate before string (2). Using the i;octet collation on
  415. the original strings, string (3) will collate before string (1).
  416. So the final ordering is as follows: (4) (2) (3) (1).
  417. If the substring operation (e.g., IMAP SEARCH) of the active
  418. comparator returns the "undefined" result (see Section 4.2.3 of
  419. [RFC4790]) for either the text specified in the SEARCH command or the
  420. message text, then the operation is repeated on the result of step
  421. (a) using the i;octet comparator.
  422. The ordering operation (e.g., IMAP SORT and THREAD) SHOULD collate
  423. the following together: strings encoded using unknown or invalid
  424. character encodings, strings in unrecognized charsets, and invalid
  425. input (as defined by the active collation).
  426. 4.7. COMPARATOR Command
  427. Arguments: Optional comparator order arguments.
  428. Response: A possible COMPARATOR response (see Section 4.8).
  429. Result: OK - Command completed
  430. NO - No matching comparator found
  431. BAD - Arguments invalid
  432. The COMPARATOR command is valid in authenticated and selected states.
  433. The COMPARATOR command is used to determine or change the active
  434. comparator. When issued with no arguments, it results in a
  435. COMPARATOR response indicating the currently active comparator.
  436. When issued with one or more comparator arguments, it changes the
  437. active comparator as directed. (If more than one installed
  438. comparator is matched by an argument, the first argument wins.) The
  439. COMPARATOR response lists all matching comparators if more than one
  440. matches the specified patterns.
  441. The argument "default" refers to the server's default comparator.
  442. Otherwise, each argument is a collation specification as defined in
  443. the Internet Application Protocol Comparator Registry [RFC4790].
  444. < The client requests activating a Czech comparator if possible,
  445. or else a generic international comparator which it considers
  446. suitable for Czech. The server picks the first supported
  447. comparator. >
  448. Newman, et al. Standards Track [Page 13]
  449. RFC 5255 IMAP Internationalization June 2008
  450. C: A001 COMPARATOR "cz;*" i;basic
  451. S: * COMPARATOR i;basic
  452. S: A001 OK Will use i;basic for collation
  453. 4.8. COMPARATOR Response
  454. Contents: The active comparator. An optional list of available
  455. matching comparators
  456. The COMPARATOR response occurs as a result of a COMPARATOR command.
  457. The first argument in the comparator response is the name of the
  458. active comparator. The second argument is a list of comparators
  459. which matched any of the arguments to the COMPARATOR command and is
  460. present only if more than one match is found.
  461. 4.9. BADCOMPARATOR Response Code
  462. This response code SHOULD be returned as a result of server failing
  463. an IMAP command (returning NO), when the server knows that none of
  464. the specified comparators match the requested comparator(s).
  465. 4.10. Formal Syntax
  466. The following syntax specification inherits ABNF [RFC5234] rules from
  467. IMAP4rev1 [RFC3501] and the Internet Application Protocol Comparator
  468. Registry [RFC4790].
  469. command-auth =/ comparator-cmd
  470. resp-text-code =/ "BADCOMPARATOR"
  471. comparator-cmd = "COMPARATOR" *(SP comp-order-quoted)
  472. response-payload =/ comparator-data
  473. comparator-data = "COMPARATOR" SP comp-sel-quoted [SP "("
  474. comp-id-quoted *(SP comp-id-quoted) ")"]
  475. comp-id-quoted = astring
  476. ; Once any literal wrapper or quoting is removed, this
  477. ; follows the collation-id rule from [RFC4790]
  478. comp-order-quoted = astring
  479. ; Once any literal wrapper or quoting is removed, this
  480. ; follows the collation-order rule from [RFC4790]
  481. Newman, et al. Standards Track [Page 14]
  482. RFC 5255 IMAP Internationalization June 2008
  483. comp-sel-quoted = astring
  484. ; Once any literal wrapper or quoting is removed, this
  485. ; follows the collation-selected rule from [RFC4790]
  486. 5. Other IMAP Internationalization Issues
  487. The following sections provide an overview of various other IMAP
  488. internationalization issues. These issues are not resolved by this
  489. specification, but could be resolved by other standards work, such as
  490. that being done by the EAI working group (see [IMAP-EAI]).
  491. 5.1. Unicode Userids and Passwords
  492. IMAP4rev1 currently restricts the userid and password fields of the
  493. LOGIN command to US-ASCII. The "userid" and "password" fields of the
  494. IMAP LOGIN command are restricted to US-ASCII only until a future
  495. standards track RFC states otherwise. Servers are encouraged to
  496. validate both fields to make sure they conform to the formal syntax
  497. of UTF-8 and to reject the LOGIN command if that syntax is violated.
  498. Servers MAY reject the LOGIN command if either the "userid" or
  499. "password" field contains an octet with the highest bit set.
  500. When AUTHENTICATE is used, some servers may support userids and
  501. passwords in Unicode [RFC3490] since SASL (see [RFC4422]) allows
  502. that. However, such userids cannot be used as part of email
  503. addresses.
  504. 5.2. UTF-8 Mailbox Names
  505. The modified UTF-7 mailbox naming convention described in Section
  506. 5.1.3 of RFC 3501 is best viewed as an transition from the status quo
  507. in 1996 when modified UTF-7 was first specified. At that time, there
  508. was widespread unofficial use of local character sets such as ISO-
  509. 8859-1 and Shift-JIS for non-ASCII mailbox names, with resultant
  510. non-interoperability.
  511. The requirements in Section 5.1 of RFC 3501 are very important if
  512. we're ever going to be able to deploy UTF-8 mailbox names. Servers
  513. are encouraged to enforce them.
  514. 5.3. UTF-8 Domains, Addresses, and Mail Headers
  515. There is now an IETF standard for "Internationalizing Domain Names in
  516. Applications (IDNA)" [RFC3490]. While IMAP clients are free to
  517. support this standard, an argument can be made that it would be
  518. helpful to simple clients if the IMAP server could perform this
  519. conversion (the same argument would apply to MIME header encoding
  520. Newman, et al. Standards Track [Page 15]
  521. RFC 5255 IMAP Internationalization June 2008
  522. [RFC2047]). However, it would be unwise to move forward with such
  523. work until the work in progress to define the format of international
  524. email addresses is complete.
  525. 6. IANA Considerations
  526. IANA added LANGUAGE, I18NLEVEL=1, and I18NLEVEL=2 to the IMAP4
  527. Capabilities Registry.
  528. 7. Security Considerations
  529. The LANGUAGE extension makes a new command available in "Not
  530. Authenticated" state in IMAP. Some IMAP implementations run with
  531. root privilege when the server is in "Not Authenticated" state and do
  532. not revoke that privilege until after authentication is complete.
  533. Such implementations are particularly vulnerable to buffer overflow
  534. security errors at this stage and need to implement parsing of this
  535. command with extra care.
  536. A LANGUAGE command issued prior to activation of a security layer is
  537. subject to an active attack that suppresses or modifies the
  538. negotiation, and thus makes STARTTLS or authentication error messages
  539. more difficult to interpret. This is not a new attack as the error
  540. messages themselves are subject to active attack. Clients MUST re-
  541. issue the LANGUAGE command once a security layer is active, in order
  542. to prevent this attack from impacting subsequent protocol operations.
  543. LANGUAGE, I18NLEVEL=1, and I18NLEVEL=2 extensions use the UTF-8
  544. charset; thus, the security considerations for UTF-8 [RFC3629] are
  545. relevant. However, neither uses UTF-8 for identifiers, so the most
  546. serious concerns do not apply.
  547. 8. Acknowledgements
  548. The LANGUAGE extension is based on a previous document by Mike
  549. Gahrns, a substantial portion of the text in that section was written
  550. by him. Many people have participated in discussions about an IMAP
  551. Language extension in the various fora of the IETF and Internet
  552. working groups, so any list of contributors is bound to be
  553. incomplete. However, the authors would like to thank Andrew McCown
  554. for early work on the original proposal, John Myers for suggestions
  555. regarding the namespace issue, along with Jutta Degener, Mark
  556. Crispin, Mark Pustilnik, Larry Osterman, Cyrus Daboo, Martin Duerst,
  557. Timo Sirainen, Ben Campbell, and Magnus Nystrom for their many
  558. suggestions that have been incorporated into this document.
  559. Initial discussion of the I18NLEVEL=2 extension involved input from
  560. Mark Crispin and other participants of the IMAP Extensions WG.
  561. Newman, et al. Standards Track [Page 16]
  562. RFC 5255 IMAP Internationalization June 2008
  563. 9. Relevant Sources of Documents for Internationalized IMAP
  564. Implementations
  565. This is a non-normative list of sources to consider when implementing
  566. i18n-aware IMAP software.
  567. o The LANGUAGE and I18NLEVEL=2 extensions to IMAP (this
  568. specification).
  569. o The 8-bit rules for mailbox naming in Section 5.1 of RFC 3501.
  570. o The Mailbox International Naming Convention in Section 5.1.3 of
  571. RFC 3501.
  572. o MIME [RFC2045] for message bodies.
  573. o MIME header encoding [RFC2047] for message headers.
  574. o The IETF EAI working group.
  575. o MIME Parameter Value and Encoded Word Extensions [RFC2231] for
  576. filenames. Quality IMAP server implementations will
  577. automatically combine multipart parameters when generating the
  578. BODYSTRUCTURE. There is also some deployed non-standard use of
  579. MIME header encoding inside double quotes for filenames.
  580. o IDNA [RFC3490] and punycode [RFC3492] for domain names
  581. (currently only relevant to IMAP clients).
  582. o The UTF-8 charset [RFC3629].
  583. o The IETF policy on Character Sets and Languages [RFC2277].
  584. 10. Normative References
  585. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
  586. Requirement Levels", BCP 14, RFC 2119, March 1997.
  587. [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and
  588. Languages", BCP 18, RFC 2277, January 1998.
  589. [RFC2342] Gahrns, M. and C. Newman, "IMAP4 Namespace", RFC 2342, May
  590. 1998.
  591. [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
  592. 4rev1", RFC 3501, March 2003.
  593. Newman, et al. Standards Track [Page 17]
  594. RFC 5255 IMAP Internationalization June 2008
  595. [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
  596. 10646", STD 63, RFC 3629, November 2003.
  597. [RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for
  598. Syntax Specifications: ABNF", STD 68, RFC 5234, January
  599. 2008.
  600. [RFC4422] Melnikov, A., Ed., and K. Zeilenga, Ed., "Simple
  601. Authentication and Security Layer (SASL)", RFC 4422, June
  602. 2006.
  603. [RFC4466] Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4
  604. ABNF", RFC 4466, April 2006.
  605. [RFC4646] Phillips, A. and M. Davis, "Tags for Identifying
  606. Languages", BCP 47, RFC 4646, September 2006.
  607. [RFC4647] Phillips, A. and M. Davis, "Matching of Language Tags",
  608. BCP 47, RFC 4647, September 2006.
  609. [RFC4790] Newman, C., Duerst, M., and A. Gulbrandsen, "Internet
  610. Application Protocol Collation Registry", RFC 4790, March
  611. 2007.
  612. [SORT] Crispin, M. and K. Murchison, "Internet Message Access
  613. Protocol - SORT and THREAD Extensions", RFC 5256, June
  614. 2008.
  615. [UCM] Crispin, M., "i;unicode-casemap - Simple Unicode Collation
  616. Algorithm", RFC 5051, October 2007.
  617. [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
  618. Extensions (MIME) Part One: Format of Internet Message
  619. Bodies", RFC 2045, November 1996.
  620. [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions)
  621. Part Three: Message Header Extensions for Non-ASCII Text",
  622. RFC 2047, November 1996.
  623. 11. Informative References
  624. [RFC2231] Freed, N. and K. Moore, "MIME Parameter Value and Encoded
  625. Word Extensions: Character Sets, Languages, and
  626. Continuations", RFC 2231, November 1997.
  627. [RFC3490] Faltstrom, P., Hoffman, P., and A. Costello,
  628. "Internationalizing Domain Names in Applications (IDNA)",
  629. RFC 3490, March 2003.
  630. Newman, et al. Standards Track [Page 18]
  631. RFC 5255 IMAP Internationalization June 2008
  632. [RFC3492] Costello, A., "Punycode: A Bootstring encoding of Unicode
  633. for Internationalized Domain Names in Applications
  634. (IDNA)", RFC 3492, March 2003.
  635. [METADATA] Daboo, C., "IMAP METADATA Extension", Work in Progress,
  636. April 2008.
  637. [IMAP-EAI] Resnick, P., and C. Newman, "IMAP Support for UTF-8", Work
  638. in Progress, November 2007.
  639. Authors' Addresses
  640. Chris Newman
  641. Sun Microsystems
  642. 3401 Centrelake Dr., Suite 410
  643. Ontario, CA 91761
  644. US
  645. EMail: chris.newman@sun.com
  646. Arnt Gulbrandsen
  647. Oryx Mail Systems GmbH
  648. Schweppermannstr. 8
  649. D-81671 Muenchen
  650. Germany
  651. EMail: arnt@oryx.com
  652. Fax: +49 89 4502 9758
  653. Alexey Melnikov
  654. Isode Limited
  655. 5 Castle Business Village, 36 Station Road,
  656. Hampton, Middlesex, TW12 2BX, UK
  657. EMail: Alexey.Melnikov@isode.com
  658. Newman, et al. Standards Track [Page 19]
  659. RFC 5255 IMAP Internationalization June 2008
  660. Full Copyright Statement
  661. Copyright (C) The IETF Trust (2008).
  662. This document is subject to the rights, licenses and restrictions
  663. contained in BCP 78, and except as set forth therein, the authors
  664. retain all their rights.
  665. This document and the information contained herein are provided on an
  666. "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
  667. OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
  668. THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
  669. OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
  670. THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
  671. WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  672. Intellectual Property
  673. The IETF takes no position regarding the validity or scope of any
  674. Intellectual Property Rights or other rights that might be claimed to
  675. pertain to the implementation or use of the technology described in
  676. this document or the extent to which any license under such rights
  677. might or might not be available; nor does it represent that it has
  678. made any independent effort to identify any such rights. Information
  679. on the procedures with respect to rights in RFC documents can be
  680. found in BCP 78 and BCP 79.
  681. Copies of IPR disclosures made to the IETF Secretariat and any
  682. assurances of licenses to be made available, or the result of an
  683. attempt made to obtain a general license or permission for the use of
  684. such proprietary rights by implementers or users of this
  685. specification can be obtained from the IETF on-line IPR repository at
  686. http://www.ietf.org/ipr.
  687. The IETF invites any interested party to bring to its attention any
  688. copyrights, patents or patent applications, or other proprietary
  689. rights that may cover technology that may be required to implement
  690. this standard. Please address the information to the IETF at
  691. ietf-ipr@ietf.org.
  692. Newman, et al. Standards Track [Page 20]