RFC 8266
Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames
Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames π
- Series: Internet Engineering Task Force (IETF) π
- Request for Comments: 8266 π¦
- Written by: P. Saint-Andre, Jabber.org β¨
- Date: October 2017 π
- Category: Standards Track π₯
- Obsoletes: 7700 π
- ISSN: 2070-1721 π
Abstract πΈ
Okay bestie, this doc is all about Unicode strings that act as memorable, human-friendly names. We're talking "nicknames", "display names", or "petnames" for people, devices, accounts, websites, and literally anything else π§ It also obsoletes RFC 7700, so this is the new hotness π
Status of This Memo π
This is an Internet Standards Track document. β¨
It's a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). For more on Internet Standards, check out Section 2 of RFC 7841 π«Ά
For the current status, any errata, and how to give feedback, go to https://www.rfc-editor.org/info/rfc8266 π
Copyright Notice β
Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved. π
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as in effect on the date of publication. Please read these carefully, because they spell out your rights and restrictions for this document π Code Components pulled from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License π
Table of Contents π
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3
2. Nickname Profile . . . . . . . . . . . . . . . . . . . . . . 4
2.1. Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2. Preparation . . . . . . . . . . . . . . . . . . . . . . . 5
2.3. Enforcement . . . . . . . . . . . . . . . . . . . . . . . 5
2.4. Comparison . . . . . . . . . . . . . . . . . . . . . . . 6
3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4. Use in Application Protocols . . . . . . . . . . . . . . . . 8
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
6. Security Considerations . . . . . . . . . . . . . . . . . . . 9
6.1. Authentication and Authorization . . . . . . . . . . . . 9
6.2. Reuse of PRECIS . . . . . . . . . . . . . . . . . . . . . 10
6.3. Reuse of Unicode . . . . . . . . . . . . . . . . . . . . 10
6.4. Visually Similar Characters . . . . . . . . . . . . . . . 10
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 10
7.1. Normative References . . . . . . . . . . . . . . . . . . 10
7.2. Informative References . . . . . . . . . . . . . . . . . 11
Appendix A. Changes from RFC 7700 . . . . . . . . . . . . . . . 12
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 12
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction β¨
1.1. Overview π
Okay so a bunch of technologies let a person pick a memorable, human-friendly name for a chat, or set one for something else like a device, account, contact, or website π¦ These get called "nicknames" (in chat rooms), "display names" (in Internet mail), or "petnames" (see [PETNAME-SYSTEMS]). This doc just calls them all "nicknames" for consistency π«Ά
Nicknames show up in textual chat room tech like:
- Internet Relay Chat (IRC) [RFC2811]
- The Message Session Relay Protocol (MSRP) [RFC4975] [RFC7701]
- Centralized Conferencing (XCON) [RFC5239] [XCON-SYSTEM]
- The Extensible Messaging and Presence Protocol (XMPP) [RFC6120] [XEP-0045]
Newer chat tech lets nicknames be internationalized too, since they can use code points from outside the ASCII range [RFC20], usually via the Unicode coded character set [Unicode]. Even though these nicknames are mostly for display, sometimes apps use them programmatically too, like kicking someone out of a chat room or avoiding nickname clashes π
A similar vibe applies when someone sets their own preferred display name or sets one for another user. Examples are the "display-name" construct in the Internet message format [RFC5322] and the <nick/> element in XMPP [XEP-0172] π
Memorable names pop up outside of personal messaging too: device names in a network visualization app, website names for bookmarks in a web browser, account names for a list of payees in a bank account, people names in a contact list app, and so on πΈ
The rules in this document work in all of those contexts β¨
Here's the big thing to understand: a nickname is a personally memorable name or handle for something with a more stable, underlying identity, like a URI or a file path π§ To keep apps that use nicknames secure, authentication and authorization decisions MUST be made on the basis of the thing's identity, not its nickname. No cap, this is the most important line in the whole intro π₯
To make memorable names work sensibly for typical users all over the world, this document sets rules for handling nicknames through the preparation, enforcement, and comparison of internationalized strings (PRECIS) framework specification [RFC8264] π
1.2. Terminology π
Lots of the important terms here are defined in [RFC8264], [RFC6365], and [Unicode] π
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. π
2. Nickname Profile π
2.1. Rules π
These rules apply within the Nickname profile of the PRECIS FreeformClass defined in the PRECIS framework specification [RFC8264] π
- Width Mapping Rule: There is no width mapping rule. (Such a rule is not necessary because width mapping happens as part of normalization using Normalization Form KC (NFKC), as specified below.) πΈ
- Additional Mapping Rule: This rule has the following sub-rules. β¨
- a. Map any instances of non-ASCII space to SPACE (U+0020). A non-ASCII space is any Unicode code point with a general category of
Zs, except SPACE (U+0020) itself. (Only allowing ASCII space avoids confusion with the many non-ASCII space code points that are hard to type across different input methods π) - b. Remove any ASCII space at the beginning or end of a nickname. For example,
"stpeter "is mapped to"stpeter"π - c. Map any interior run of more than one ASCII space down to a single ASCII space. For example,
"St Peter"is mapped to"St Peter"π¦
- a. Map any instances of non-ASCII space to SPACE (U+0020). A non-ASCII space is any Unicode code point with a general category of
- Case Mapping Rule: Apply the Unicode toLowerCase() operation, as defined in the Unicode Standard [Unicode]. In apps that ban conflicting nicknames, this helps avoid confusion by making sure nicknames that differ only by case (like
"stpeter"vs."StPeter") wouldn't show up to a human user at the same time. (As explained below, this is typically appropriate only for comparison, not for enforcement.) π§ - Normalization Rule: Apply Unicode Normalization Form KC. NFKC is more "aggressive" at finding matches than other normalization forms. In Unicode terms, it does both canonical and compatibility decomposition before recomposing code points, so this rule cuts down on confusion by increasing the number of code points that match. For example, the character
β £(ROMAN NUMERAL FOUR, U+2163) would match the combination ofI(LATIN CAPITAL LETTER I, U+0049) andV(LATIN CAPITAL LETTER V, U+0056) π₯ - Directionality Rule: There is no directionality rule. The "Bidi Rule" (defined in [RFC5893]) and similar rules are unnecessary and don't apply to nicknames. It's perfectly fine for a nickname to be shown differently in different layout systems (for example, a UI set up mainly for a right-to-left script versus one set up mainly for a left-to-right script), as long as it looks consistent within any given layout system π
Plot twist π Applying the Nickname profile rules isn't idempotent for every code point, which means running them once isn't always enough. So an implementation SHOULD apply the rules repeatedly until the output string is stable. If the output still hasn't stabilized after three (3) more rounds past the first application, the implementation SHOULD stop applying the rules and reject the input string as invalid. Bestie, that's a whole cutoff system π
2.2. Preparation πΈ
An entity that prepares an input string for later enforcement under this profile MUST make sure the string only has Unicode code points that conform to the FreeformClass string class defined in [RFC8264] β¨
2.3. Enforcement π
An entity that does enforcement under this profile MUST prepare an input string as described in Section 2.2, and it MUST also apply the following rules from Section 2.1, in the order shown: π«Ά
- Additional Mapping Rule
- Normalization Rule
Note: An entity SHOULD apply the Case Mapping Rule only during comparison. π
After all of the rules above have been enforced, the entity MUST make sure the nickname is not zero bytes in length. This check happens after the rules so apps don't accidentally drop a nickname entirely. When internationalized strings are accepted, a non-empty sequence of characters can turn into a zero-length nickname after canonicalization, and that's the sneaky case this catches π
The result of all those operations is an output string that conforms to the Nickname profile. Until an implementation produces such an output string, it MUST NOT treat the string as conforming. In particular, it MUST NOT assume that an input string is conforming before the enforcement operation has been completed. Don't skip ahead, bestie π
2.4. Comparison
okay bestie, comparison time π any entity comparing two strings under this profile MUST prepare each input string the way Section 2.2 says, and then MUST apply the Section 2.1 rules in this exact order:
- Additional Mapping Rule
- Case Mapping Rule
- Normalization Rule
the two strings only count as equivalent if they're an exact octet-for-octet match (aka "bit-string identity") π«Ά
and here's the vibe check: until an implementation has actually worked out whether two strings are equivalent, it MUST NOT treat them as equivalent π like, it MUST NOT assume two inputs match before the comparison is totally finished β¨
3. Examples β¨
these are a few nicknames that fit the format above, plus the output you get after the PRECIS rules are applied for comparison π (heads up: the "<" and ">" just outline the nickname so you can see it, they're not part of the actual string πΈ)
+---------------------------+-------------------------------------+
| # | Nickname | Output for Comparison |
+---------------------------+-------------------------------------+
| 1 | <Foo> | <foo> |
+---------------------------+-------------------------------------+
| 2 | <foo> | <foo> |
+---------------------------+-------------------------------------+
| 3 | <Foo Bar> | <foo bar> |
+---------------------------+-------------------------------------+
| 4 | <foo bar> | <foo bar> |
+---------------------------+-------------------------------------+
| 5 | <Ξ£> | Ο (GREEK SMALL LETTER SIGMA, |
| | | U+03C3) |
+---------------------------+-------------------------------------+
| 6 | <Ο> | Ο (GREEK SMALL LETTER SIGMA, |
| | | U+03C3) |
+---------------------------+-------------------------------------+
| 7 | <Ο> | Ο (GREEK SMALL LETTER FINAL SIGMA, |
| | | U+03C2) |
+---------------------------+-------------------------------------+
| 8 | <Ο> | Ο (GREEK SMALL LETTER UPSILON |
| | | WITH DIALYTIKA, U+03CB) |
+---------------------------+-------------------------------------+
| 9 | <β> | β (INFINITY, U+221E) |
+---------------------------+-------------------------------------+
| 10 | <Richard β
£> | <richard iv> |
+---------------------------+-------------------------------------+
Table 1: A Sample of Legal Nicknames
okay so for examples 5, 6, and 7 π€ applying the Unicode toLowerCase() operation to "Ξ£" (GREEK CAPITAL LETTER SIGMA, U+03A3) gives you "Ο" (GREEK SMALL LETTER SIGMA, U+03C3), BUT toLowerCase() leaves "Ο" (GREEK SMALL LETTER FINAL SIGMA, U+03C2) totally alone π so the comparison operation from Section 2.4 matches examples 5 and 6, but it does NOT match 5 and 7, or 6 and 7. plot twist, the sigmas are not all the same π
example 8 is a serious main character moment π applying these rules is NOT an idempotent procedure here (see Section 2.1), which means running it again can change things. specifically:
- toLowerCase() on "Ο" (GREEK UPSILON WITH DIARESIS AND HOOK SYMBOL, U+03D4) does nothing, but NFKC on that same character gives you "Ξ«" (GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA, U+03AB).
- toLowerCase() on "Ξ«" (GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA, U+03AB) gives you "Ο" (GREEK SMALL LETTER UPSILON WITH DIALYTIKA, U+03CB), and NFKC on that one does nothing.
example 9 is giving symbols π "β" (INFINITY, U+221E) is allowed by the PRECIS FreeformClass, so yes, you can use it in a nickname βΎοΈ
and example 10 is a whole mood π§ toLowerCase() on "β £" (ROMAN NUMERAL FOUR, U+2163) gives you "β ³" (SMALL ROMAN NUMERAL FOUR, U+2173), and then NFKC on "β ³" turns it into the two characters "i" (LATIN SMALL LETTER I, U+0069) and "v" (LATIN SMALL LETTER V, U+0076) π
4. Use in Application Protocols π¦
okay so this spec ONLY defines the PRECIS-based rules for handling nickname strings π it's up to an application protocol (for example MSRP, XCON, or XMPP) or an application definition to decide which protocol slots can hold nickname strings, which entities are expected to enforce the nickname rules, and when during protocol processing or interface handling those rules get enforced. for tips on using PRECIS profiles in apps, check Section 6 of [RFC8264] π
on top of the PRECIS rules here, application protocols can add their own rules for nicknames too πΈ think minimum or maximum length, extra restrictions on allowed code points or character ranges, safeguards against visually similar characters, and so on.
application protocols can also set rules for how nicknames actually get used in apps π things like reserved nicknames, authorization requirements for using a nickname, whether certain nicknames can be banned, how duplicates are handled, and how nicknames relate to underlying identifiers such as SIP URIs or Jabber IDs.
entities that enforce the rules in this document are encouraged to be liberal in what they accept π«Ά by following this procedure:
- Where possible, map characters (for example through width mapping, additional mapping, case mapping, or normalization) and accept the mapped string.
- If mapping isn't possible (for example, because a character is disallowed in the FreeformClass), reject the string.
5. IANA Considerations π
IANA has added the following entry to the "PRECIS Profiles" registry π
Name: Nickname.
Base Class: FreeformClass.
Applicability: Nicknames or display names in messaging and text
conferencing technologies; petnames for devices, accounts, and
people; and other uses of nicknames, display names, or petnames.
Replaces: None.
Width Mapping Rule: None (handled via NFKC).
Additional Mapping Rule: Map non-ASCII space characters to SPACE
(U+0020), strip leading and trailing space characters, and map
interior sequences of multiple space characters to a single
instance of SPACE (U+0020).
Case Mapping Rule: Map uppercase and titlecase code points to
lowercase using the Unicode toLowerCase() operation.
Normalization Rule: NFKC.
Directionality Rule: None.
Enforcement: To be specified by applications.
Specification: RFC 8266.
6. Security Considerations π
6.1. Authentication and Authorization
π¨ this one is serious, bestie. a nickname is a personally memorable name or handle for something with a more stable, underlying identity (like a URI or a file path). so to keep apps secure, authentication and authorization decisions MUST be made based on the thing's identity, NOT its nickname π ββοΈ
6.2. Reuse of PRECIS
the security considerations in [RFC8264] also apply to the FreeformClass string class this document uses for nicknames π‘οΈ
6.3. Reuse of Unicode
the security considerations in [UTS39] apply to the use of Unicode code points in nicknames π
6.4. Visually Similar Characters
[RFC8264] covers some of the security considerations around visually similar characters (also called "confusable characters" or "confusables") and gives some examples of them π
the mapping rules in Section 2 of this document are designed, in part, to cut down on confusion about nicknames π but this document does NOT give more detailed guidance on handling visually similar characters, like the kind found in [UTS39] π
7. References π
7.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>.
[RFC5893] Alvestrand, H., Ed. and C. Karp, "Right-to-Left Scripts
for Internationalized Domain Names for Applications
(IDNA)", RFC 5893, DOI 10.17487/RFC5893, August 2010,
<https://www.rfc-editor.org/info/rfc5893>.
[RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in
Internationalization in the IETF", BCP 166, RFC 6365,
DOI 10.17487/RFC6365, September 2011,
<https://www.rfc-editor.org/info/rfc6365>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC8264] Saint-Andre, P. and M. Blanchet, "PRECIS Framework:
Preparation, Enforcement, and Comparison of
Internationalized Strings in Application Protocols",
RFC 8264, DOI 10.17487/RFC8264, October 2017,
<https://www.rfc-editor.org/info/rfc8264>.
[Unicode] The Unicode Consortium, "The Unicode Standard",
<http://www.unicode.org/versions/latest/>.
[UTS39] Unicode Technical Standard #39, "Unicode Security
Mechanisms", edited by Mark Davis and Michel Suignard,
<http://unicode.org/reports/tr39/>.
7.2. Informative References β¨
okay bestie, here's the optional reading list π these aren't needed to implement the spec, but they give you the whole backstory π¦
[Err4570]: RFC Errata, Erratum ID 4570, RFC 7700,https://www.rfc-editor.org/errata/eid4570.[PETNAME-SYSTEMS]: Stiegler, M., "An Introduction to Petname Systems", updated June 2010, February 2005,http://www.skyhunter.com/marcs/petnames/IntroPetNames.html.[RFC20]: Cerf, V., "ASCII format for network interchange", STD 80, RFC 20, DOI 10.17487/RFC0020, October 1969,https://www.rfc-editor.org/info/rfc20. πΈ[RFC2811]: Kalt, C., "Internet Relay Chat: Channel Management", RFC 2811, DOI 10.17487/RFC2811, April 2000,https://www.rfc-editor.org/info/rfc2811. π¬[RFC4975]: Campbell, B., Ed., Mahy, R., Ed., and C. Jennings, Ed., "The Message Session Relay Protocol (MSRP)", RFC 4975, DOI 10.17487/RFC4975, September 2007,https://www.rfc-editor.org/info/rfc4975.[RFC5239]: Barnes, M., Boulton, C., and O. Levin, "A Framework for Centralized Conferencing", RFC 5239, DOI 10.17487/RFC5239, June 2008,https://www.rfc-editor.org/info/rfc5239.[RFC5322]: Resnick, P., Ed., "Internet Message Format", RFC 5322, DOI 10.17487/RFC5322, October 2008,https://www.rfc-editor.org/info/rfc5322. π§[RFC6120]: Saint-Andre, P., "Extensible Messaging and Presence Protocol (XMPP): Core", RFC 6120, DOI 10.17487/RFC6120, March 2011,https://www.rfc-editor.org/info/rfc6120. β¨[RFC7700]: Saint-Andre, P., "Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames", RFC 7700, DOI 10.17487/RFC7700, December 2015,https://www.rfc-editor.org/info/rfc7700. π[RFC7701]: Niemi, A., Garcia-Martin, M., and G. Sandbakken, "Multi-party Chat Using the Message Session Relay Protocol (MSRP)", RFC 7701, DOI 10.17487/RFC7701, December 2015,https://www.rfc-editor.org/info/rfc7701.[XCON-SYSTEM]: Barnes, M., Boulton, C., and S. Loreto, "Chatrooms within a Centralized Conferencing (XCON) System", Work in Progress, draft-boulton-xcon-session-chat-08, July 2012. π§[XEP-0045]: Saint-Andre, P., "Multi-User Chat", XSF XEP 0045, September 2017,https://xmpp.org/extensions/xep-0045.html.[XEP-0172]: Saint-Andre, P. and V. Mercier, "User Nickname", XSF XEP 0172, March 2012,https://xmpp.org/extensions/xep-0172.html. π
Appendix A. Changes from RFC 7700 π
okay so here's the glow-up log, the changes made from [RFC7700] π
- Addressed [Err4570] by removing the directionality rule from Sections 2.3 and 2.4. no more directionality rule, periodt π
- In accordance with working group discussions and updates to [RFC8264], removed the use of the Unicode
toCaseFold()operation in favor of the UnicodetoLowerCase()operation. β¨ - Clarified several editorial matters. π¦
- Updated references. π
Acknowledgements π«Ά
Huge thanks to William Fisher for his implementation feedback, especially regarding idempotence. the implementer energy is unmatched π₯
Thanks to Sam Whited for his feedback and for submitting [Err4570]. π
See [RFC7700] for acknowledgements related to the specification that this document supersedes. go check that one too, it's giving history πΈ
Author's Address π
Peter Saint-Andre
Jabber.org
P.O. Box 787
Parker, CO 80134
United States of America
Phone: +1 720 256 6756
Email: stpeter@jabber.org
URI: https://www.jabber.org/
π¦ where this page comes from
- ietf: rfc8266 2017-10
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms