Case transformations in strings

Lasse R.H. Nielsen atwork at infimum.dk
Tue Mar 24 02:46:29 PDT 2009


On Tue, 24 Mar 2009 00:50:24 +0100, David-Sarah Hopwood  
<david.hopwood at industrial-designers.co.uk> wrote:

> If converting one character to many would cause a problem with the
> reference to toUpperCase in the regular expression algorithm, then
> presumably Safari and Chrome would hit that problem. Do they, or
> do they use different uppercase conversions for regexps vs
> toUpperCase?

The Regular Expression specification in ES3 doesn't use toUpperCase  
directly, but rather the
Canonicalize helper function (15.10.2.8). It states:

  2. Let u be ch converted to upper case as if by calling  
String.prototype.toUpperCase on the one-character
     string ch.
  3. If u does not consist of a single character, return ch.

I.e., it uses a different algorithm for regexps than for strings.
(It also prevents non-ASCII characters from canonicalizing to ASCII  
characters.)

> If the latter, then we should allow that, and probably require it.

It's allowed, and required, already, so that's an easy fix :)

/Lasse


More information about the Es-discuss mailing list