Concerning UTF-16 surrogate pairs, how about a function like:
String.isValid( str )
to discover whether surrogates are used correctly in 'str'?
Something like Array.isArray().
Nb. Already encodeURI throws an URIError exception if 'str' is not a
well-formed UTF-16 string.
-------------
1. Definition of string. You say:
--
However,
ECMAScript does not place any restrictions or requirements on the
sequence of code units in a String value, so it may be ill-formed when
interpreted as a UTF-16 code unit sequence.
--
I know what you mean, but others might not. Perhaps:
--
However, ECMAScript does not place any restrictions or requirements on the
sequence of code units in a String value, so the sequence of code units
may contain code units that are not valid in Unicode or sequences that do
not represent Unicode code points (such as unpaired surrogates).
--
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss