Unicode

Devin Asay devin_asay at byu.edu
Tue May 10 14:12:41 EDT 2005


On May 9, 2005, at 8:44 PM, pkc wrote:

> Many thanks to Devin for his wonderful site. I am still hung up on a 
> problem very closely related to Thomas McGrath's, however.  Like him, 
> I am working on a project that calls for mixing Asian (in my case, 
> Chinese) characters with English text.  Both the English and the 
> Chinese elements are fixed, so I hit on the strategy of downloading 
> the English text as an English text with markers for Chinese 
> characters, then getting the client to feed characters from the 
> Chinese text into the English text; then the client identifies the 
> imported elements through reference to the list they came from and 
> setting the textFont of the foundChunk to ",chinese."
>
> This works extremely well on my machine (OS X). In fact, it works 
> perfectly. However, nobody using it on a Windows machine gets the 
> right characters (they get about 40% correct characters and the rest 
> is junk).  this is very perplexing, since the whole point of Unicode 
> is supposed to be that the characters are unique and will render 
> correctly in either Mac or Windows. But they don't.

We have found this problem also with cross platform applications that 
must display unicode in fields. We finally arrived at a workaround in 
which we use html text with unicode entities. That seems to be the most 
reliable way to get two-byte characters to show up reliably cross 
platform. This is what we did:

- Type the text into a field using Mac OS X's native input methods for 
Chinese (in this example.)
- put the htmlText of that field into some container, or into an 
external file. When you do this, every unicode character is converted 
to html unicode entities. These seem to be reliably rendered cross 
platform.
- When you need to display the text, set the htmlText of the field to 
the previously-saved htmltext.

Yeah, I know, kludgey but reliable.

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University



More information about the use-livecode mailing list