Subject: Re: [idn] ToUnicode output can be longer than input

From: "Edmon Chung" <[email-masked]>
Date: Fri, 25 Apr 2003 16:35:10 -0400

Hi Adam,

----- Original Message -----
From: "Adam M. Costello" <[email-masked]>
> > > x n - - fi fi - a ffl u e n t - s o u ffl - viii - u i c
> > >
> > > The spaces are not really there, they just indicate the clusters,
which
> > > represent single code points (ligatures and roman numerals: U+FB01,
> > > U+FB04, U+2177).  That's 24 code points.
> >
> > If I counted it correctly, there are 33 "codepoints" in the above ACE
> > string.
>
> fi represents one code point (U+FB01), ffl represents one code point
> (U+FB04), and viii represents one code point (U+2177).  Now if you count
> again, you should count 24.  I'm trying to describe a non-ASCII ACE
> string containing 24 code points, some of which are ASCII and some of
> which are compatibility characters.
>

I understand, your intent, however I think it would be better to find an
example that is a valid Punycode string that when ToUnicode is performed
will exceed the number of codepoints of the original.  Right now, the ACE
string provided is not valid because it contains characters beyond A-z,
0-9, -.

Edmon

---

From: "Adam M. Costello" <[email-masked]>
Date: Mon, 28 Apr 2003 20:11:36 +0000

Edmon Chung <[email-masked]> wrote:

> Right now, the ACE string provided is not valid because it contains
> characters beyond A-z, 0-9, -.

It is valid.  Some labels are ASCII and some are not.  Some labels are
ACE and some are not.  All four combinations are possible (ASCII ACE,
ASCII non-ACE, non-ASCII ACE, non-ASCII non-ACE).

An ACE label is formally defined as a label that ToUnicode would alter.
A (valid) internationalized label is formally defined as a label to
which ToASCII can be applied without failing.  It can be shown that all
ACE labels are (valid) internationalized labels.

> I think it would be better to find an example that is a valid Punycode
> string that when ToUnicode is performed will exceed the number of
> codepoints of the original.

The Punycode decoder cannot output more code points than it inputs.

If the input of ToUnicode is ASCII, then Nameprep will not be applied,
and therefore the output of ToUnicode cannot contain more code points
than the input.  It's Nameprep that can cause strings to grow, not the
Punycode decoder.

AMC