archives

« Bugzilla Issues Index

#1273 — Don't allow bitwise comparison in String.prototype.localeCompare


The ES5 specification of String.prototype.localeCompare first requires that the function "return 0 when comparing Strings that are considered canonically equivalent by the Unicode standard", but then goes on "if no language-sensitive comparison at all is available from the host environment, this function may perform a bitwise comparison."

These two sentences are incompatible with each other: A bitwise comparison will return non-zero values for many string pairs that are considered canonically equivalent by the Unicode standard.

I recommend removing the latter paragraph. This requires implementations to at least perform Unicode normalization, although still not language-sensitive comparison.


I really think the original intent was to permit basic implementations that only do bitwise comparison.

Rather than removing the bitwise comparison option I add a requirement that if "language-sensitive comparison" is performed then canonical equivalence is required.

fixed in rev21 editor's draft


fixed in rev21 draft


This bug and bug 407 need to be resolved together. See bug 407 comment 3 there. Also, is there any documentation of the original intent referred to in comment 1?


fixed in rev27


Verified fixed in bug 407.