[etoys-dev] Re: (SQ-528) Cannot input Japanese on Mac

Masashi UMEZAWA ume at blueplane.jp
Tue Oct 20 23:00:08 EDT 2009

Hi, Bert

> You replaced "utf8ToSqueak" with "convertFromEncoding: #utf8". These two are
> supposed to do the same, one is just optimized. What was the problem here?

Because the optimized version (ByteString>>utf8ToSqueak) generates a
string that does not have "leadingChar" offset, it causes a problem
when we copy & paste a multi-byte clipboard text in Squeak. (When
copying, string was Japanese string, but in paste, it becomes a raw
multibyte-string that does not have leadingChar offset).

For example:
data := #(227 129 130 227 129 132 227 129 134 227 129 136 227 129 138)
asByteArray "aiueo in Japanese".
data asString utf8ToSqueak = (data asString convertFromEncoding:
#utf8). "false..."

There would be a better solution in this part, but I was in a hurry anyway.

[:masashi | ^umezawa]

More information about the etoys-dev mailing list