bestiejs/punycode.js — Issue #3: Error in RFC 3492 Russian (Cyrillic) sample string isn’t an error
Author: mathiasbynens
Created: 2011-11-28 20:56:06+00:00
State: open

Re: https://github.com/bestiejs/punycode.js/blob/cf97d64456679fcdaa176f109060bf0c5dd419f5/tests/tests.js#L84-98

It is not a typo.

Section 5 of the RFC says:

> A decoder MUST recognize the letters in both uppercase and lowercase
> forms (including mixtures of both forms). An encoder SHOULD output
> only uppercase forms or only lowercase forms, unless it uses mixed-
> case annotation (see appendix A).

Appendix A ends with:

> These annotations do not alter the code points returned by decoders;
> the annotations are returned separately, for the caller to use or
> ignore. Encoders can accept annotations in addition to code points,
> but the annotations do not alter the output, except to influence the
> uppercase/lowercase form of ASCII letters.
>
> Punycode encoders and decoders need not support these annotations,
> and higher layers need not use them.

The examples use mixed-case annotation. The use of `D` rather than `d`
indicates that the cyrillic letter `pe` (code point 043F) (the first
letter of Russian) was originally uppercase (code point 041F) before
being case-folded by Nameprep.

The test code in the RFC looks at the case of the `u` in the input (U+043F
versus u+043F) and uses matching case for the output (`D` versus `d`).