📄 rfc3492.txt
字号:
ToUnicode performs a higher level re-encoding and comparison, and a mismatch has the same consequence as if the Punycode decoder had failed.7. Punycode examples7.1 Sample strings In the Punycode encodings below, the ACE prefix is not shown. Backslashes show where line breaks have been inserted in strings too long for one line. The first several examples are all translations of the sentence "Why can't they just speak in <language>?" (courtesy of Michael Kaplan's "provincial" page [PROVINCIAL]). Word breaks and punctuation have been removed, as is often done in domain names. (A) Arabic (Egyptian): u+0644 u+064A u+0647 u+0645 u+0627 u+0628 u+062A u+0643 u+0644 u+0645 u+0648 u+0634 u+0639 u+0631 u+0628 u+064A u+061F Punycode: egbpdaj6bu4bxfgehfvwxn (B) Chinese (simplified): u+4ED6 u+4EEC u+4E3A u+4EC0 u+4E48 u+4E0D u+8BF4 u+4E2D u+6587 Punycode: ihqwcrb4cv8a8dqg056pqjye (C) Chinese (traditional): u+4ED6 u+5011 u+7232 u+4EC0 u+9EBD u+4E0D u+8AAA u+4E2D u+6587 Punycode: ihqwctvzc91f659drss3x8bo0yb (D) Czech: Pro<ccaron>prost<ecaron>nemluv<iacute><ccaron>esky U+0050 u+0072 u+006F u+010D u+0070 u+0072 u+006F u+0073 u+0074 u+011B u+006E u+0065 u+006D u+006C u+0075 u+0076 u+00ED u+010D u+0065 u+0073 u+006B u+0079 Punycode: Proprostnemluvesky-uyb24dma41aCostello Standards Track [Page 14]RFC 3492 IDNA Punycode March 2003 (E) Hebrew: u+05DC u+05DE u+05D4 u+05D4 u+05DD u+05E4 u+05E9 u+05D5 u+05D8 u+05DC u+05D0 u+05DE u+05D3 u+05D1 u+05E8 u+05D9 u+05DD u+05E2 u+05D1 u+05E8 u+05D9 u+05EA Punycode: 4dbcagdahymbxekheh6e0a7fei0b (F) Hindi (Devanagari): u+092F u+0939 u+0932 u+094B u+0917 u+0939 u+093F u+0928 u+094D u+0926 u+0940 u+0915 u+094D u+092F u+094B u+0902 u+0928 u+0939 u+0940 u+0902 u+092C u+094B u+0932 u+0938 u+0915 u+0924 u+0947 u+0939 u+0948 u+0902 Punycode: i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd (G) Japanese (kanji and hiragana): u+306A u+305C u+307F u+3093 u+306A u+65E5 u+672C u+8A9E u+3092 u+8A71 u+3057 u+3066 u+304F u+308C u+306A u+3044 u+306E u+304B Punycode: n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa (H) Korean (Hangul syllables): u+C138 u+ACC4 u+C758 u+BAA8 u+B4E0 u+C0AC u+B78C u+B4E4 u+C774 u+D55C u+AD6D u+C5B4 u+B97C u+C774 u+D574 u+D55C u+B2E4 u+BA74 u+C5BC u+B9C8 u+B098 u+C88B u+C744 u+AE4C Punycode: 989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5j\ psd879ccm6fea98c (I) Russian (Cyrillic): U+043F u+043E u+0447 u+0435 u+043C u+0443 u+0436 u+0435 u+043E u+043D u+0438 u+043D u+0435 u+0433 u+043E u+0432 u+043E u+0440 u+044F u+0442 u+043F u+043E u+0440 u+0443 u+0441 u+0441 u+043A u+0438 Punycode: b1abfaaepdrnnbgefbaDotcwatmq2g4l (J) Spanish: Porqu<eacute>nopuedensimplementehablarenEspa<ntilde>ol U+0050 u+006F u+0072 u+0071 u+0075 u+00E9 u+006E u+006F u+0070 u+0075 u+0065 u+0064 u+0065 u+006E u+0073 u+0069 u+006D u+0070 u+006C u+0065 u+006D u+0065 u+006E u+0074 u+0065 u+0068 u+0061 u+0062 u+006C u+0061 u+0072 u+0065 u+006E U+0045 u+0073 u+0070 u+0061 u+00F1 u+006F u+006C Punycode: PorqunopuedensimplementehablarenEspaol-fmd56a (K) Vietnamese: T<adotbelow>isaoh<odotbelow>kh<ocirc>ngth<ecirchookabove>ch\ <ihookabove>n<oacute>iti<ecircacute>ngVi<ecircdotbelow>t U+0054 u+1EA1 u+0069 u+0073 u+0061 u+006F u+0068 u+1ECD u+006B u+0068 u+00F4 u+006E u+0067 u+0074 u+0068 u+1EC3 u+0063 u+0068 u+1EC9 u+006E u+00F3 u+0069 u+0074 u+0069 u+1EBF u+006E u+0067 U+0056 u+0069 u+1EC7 u+0074 Punycode: TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9gCostello Standards Track [Page 15]RFC 3492 IDNA Punycode March 2003 The next several examples are all names of Japanese music artists, song titles, and TV programs, just because the author happens to have them handy (but Japanese is useful for providing examples of single- row text, two-row text, ideographic text, and various mixtures thereof). (L) 3<nen>B<gumi><kinpachi><sensei> u+0033 u+5E74 U+0042 u+7D44 u+91D1 u+516B u+5148 u+751F Punycode: 3B-ww4c5e180e575a65lsy2b (M) <amuro><namie>-with-SUPER-MONKEYS u+5B89 u+5BA4 u+5948 u+7F8E u+6075 u+002D u+0077 u+0069 u+0074 u+0068 u+002D U+0053 U+0055 U+0050 U+0045 U+0052 u+002D U+004D U+004F U+004E U+004B U+0045 U+0059 U+0053 Punycode: -with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n (N) Hello-Another-Way-<sorezore><no><basho> U+0048 u+0065 u+006C u+006C u+006F u+002D U+0041 u+006E u+006F u+0074 u+0068 u+0065 u+0072 u+002D U+0057 u+0061 u+0079 u+002D u+305D u+308C u+305E u+308C u+306E u+5834 u+6240 Punycode: Hello-Another-Way--fc4qua05auwb3674vfr0b (O) <hitotsu><yane><no><shita>2 u+3072 u+3068 u+3064 u+5C4B u+6839 u+306E u+4E0B u+0032 Punycode: 2-u9tlzr9756bt3uc0v (P) Maji<de>Koi<suru>5<byou><mae> U+004D u+0061 u+006A u+0069 u+3067 U+004B u+006F u+0069 u+3059 u+308B u+0035 u+79D2 u+524D Punycode: MajiKoi5-783gue6qz075azm5e (Q) <pafii>de<runba> u+30D1 u+30D5 u+30A3 u+30FC u+0064 u+0065 u+30EB u+30F3 u+30D0 Punycode: de-jg4avhby1noc0d (R) <sono><supiido><de> u+305D u+306E u+30B9 u+30D4 u+30FC u+30C9 u+3067 Punycode: d9juau41awczczp The last example is an ASCII string that breaks the existing rules for host name labels. (It is not a realistic example for IDNA, because IDNA never encodes pure ASCII labels.) (S) -> $1.00 <- u+002D u+003E u+0020 u+0024 u+0031 u+002E u+0030 u+0030 u+0020 u+003C u+002D Punycode: -> $1.00 <--Costello Standards Track [Page 16]RFC 3492 IDNA Punycode March 20037.2 Decoding traces In the following traces, the evolving state of the decoder is shown as a sequence of hexadecimal values, representing the code points in the extended string. An asterisk appears just after the most recently inserted code point, indicating both n (the value preceeding the asterisk) and i (the position of the value just after the asterisk). Other numerical values are decimal. Decoding trace of example B from section 7.1: n is 128, i is 0, bias is 72 input is "ihqwcrb4cv8a8dqg056pqjye" there is no delimiter, so extended string starts empty delta "ihq" decodes to 19853 bias becomes 21 4E0D * delta "wc" decodes to 64 bias becomes 20 4E0D 4E2D * delta "rb" decodes to 37 bias becomes 13 4E3A * 4E0D 4E2D delta "4c" decodes to 56 bias becomes 17 4E3A 4E48 * 4E0D 4E2D delta "v8a" decodes to 599 bias becomes 32 4E3A 4EC0 * 4E48 4E0D 4E2D delta "8d" decodes to 130 bias becomes 23 4ED6 * 4E3A 4EC0 4E48 4E0D 4E2D delta "qg" decodes to 154 bias becomes 25 4ED6 4EEC * 4E3A 4EC0 4E48 4E0D 4E2D delta "056p" decodes to 46301 bias becomes 84 4ED6 4EEC 4E3A 4EC0 4E48 4E0D 4E2D 6587 * delta "qjye" decodes to 88531 bias becomes 90 4ED6 4EEC 4E3A 4EC0 4E48 4E0D 8BF4 * 4E2D 6587Costello Standards Track [Page 17]RFC 3492 IDNA Punycode March 2003 Decoding trace of example L from section 7.1: n is 128, i is 0, bias is 72 input is "3B-ww4c5e180e575a65lsy2b" literal portion is "3B-", so extended string starts as: 0033 0042 delta "ww4c" decodes to 62042 bias becomes 27 0033 0042 5148 * delta "5e" decodes to 139 bias becomes 24 0033 0042 516B * 5148 delta "180e" decodes to 16683 bias becomes 67 0033 5E74 * 0042 516B 5148 delta "575a" decodes to 34821 bias becomes 82 0033 5E74 0042 516B 5148 751F * delta "65l" decodes to 14592 bias becomes 67 0033 5E74 0042 7D44 * 516B 5148 751F delta "sy2b" decodes to 42088 bias becomes 84 0033 5E74 0042 7D44 91D1 * 516B 5148 751FCostello Standards Track [Page 18]RFC 3492 IDNA Punycode March 20037.3 Encoding traces In the following traces, code point values are hexadecimal, while other numerical values are decimal. Encoding trace of example B from section 7.1: bias is 72 input is: 4ED6 4EEC 4E3A 4EC0 4E48 4E0D 8BF4 4E2D 6587 there are no basic code points, so no literal portion next code point to insert is 4E0D needed delta is 19853, encodes as "ihq" bias becomes 21 next code point to insert is 4E2D needed delta is 64, encodes as "wc" bias becomes 20 next code point to insert is 4E3A needed delta is 37, encodes as "rb" bias becomes 13 next code point to insert is 4E48 needed delta is 56, encodes as "4c" bias becomes 17 next code point to insert is 4EC0 needed delta is 599, encodes as "v8a" bias becomes 32 next code point to insert is 4ED6 needed delta is 130, encodes as "8d" bias becomes 23 next code point to insert is 4EEC needed delta is 154, encodes as "qg" bias becomes 25 next code point to insert is 6587 needed delta is 46301, encodes as "056p" bias becomes 84 next code point to insert is 8BF4 needed delta is 88531, encodes as "qjye" bias becomes 90 output is "ihqwcrb4cv8a8dqg056pqjye"Costello Standards Track [Page 19]RFC 3492 IDNA Punycode March 2003 Encoding trace of example L from section 7.1: bias is 72 input is: 0033 5E74 0042 7D44 91D1 516B 5148 751F basic code points (0033, 0042) are copied to literal portion: "3B-" next code point to insert is 5148 needed delta is 62042, encodes as "ww4c" bias becomes 27 next code point to insert is 516B needed delta is 139, encodes as "5e" bias becomes 24 next code point to insert is 5E74 needed delta is 16683, encodes as "180e" bias becomes 67 next code point to insert is 751F needed delta is 34821, encodes as "575a" bias becomes 82 next code point to insert is 7D44 needed delta is 14592, encodes as "65l" bias becomes 67 next code point to insert is 91D1 needed delta is 42088, encodes as "sy2b" bias becomes 84 output is "3B-ww4c5e180e575a65lsy2b"8. Security Considerations Users expect each domain name in DNS to be controlled by a single authority. If a Unicode string intended for use as a domain label could map to multiple ACE labels, then an internationalized domain name could map to multiple ASCII domain names, each controlled by a different authority, some of which could be spoofs that hijack service requests intended for another. Therefore Punycode is designed so that each Unicode string has a unique encoding. However, there can still be multiple Unicode representations of the "same" text, for various definitions of "same". This problem is addressed to some extent by the Unicode standard under the topic of canonicalization, and this work is leveraged for domain names by Nameprep [NAMEPREP].
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -