Re: [Scheme-reports] mutable unicode strings
Per Bothner 02 Jul 2014 15:12 UTC
On 07/02/2014 12:51 AM, Sascha Ziemann wrote:
> 2014-07-02 5:29 GMT+02:00 Jim Rees <jimreesma@gmail.com
> <mailto:jimreesma@gmail.com>>:
> Java is broken. From the Java 7 documentation:
>
> "A |String| represents a string in the UTF-16 format in which
> /supplementary characters/ are represented by /surrogate pairs/.
> Index values refer to |char| code units, so a supplementary character
> uses two positions in a |String|."
>
> If you call Java to return you the third character, you will either
> get the half of a surrogate pair or a completely different character
> or the operation is is not O(1).
It's broken, if you see "get the third character" as an important
and useful operation. It isn't, in itself.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports