Unicode revisited, this time with htmlText
Klaus Major
klaus at major-k.de
Wed Nov 19 11:07:03 EST 2003
Hi Toma,
> As usual, I have a question about Unicode :) I have a text field
> whose textFont is set to "Lucida Grande", Unicode. I am using the
> message box to get some html text in it -- and I can't get it to work
> properly. The Transcript Dictionary entry for htmlText says that the
> lang attribute and ability to encode Unicode characters was added in
> 2.0 but does not go into great detail explain how that is to be done.
>
> set the htmlText of field "Field 1" to "<b>hello</b>" -- produces
> CJK gibberish
> set the htmlText of field "Field 1" to uniencode("<b>hello</b>",
> "utf8") -- produces different CJK gibberish
>
> Trying the same with a Cyrillic string:
>
> set the htmlText of field "Field 1" to "<b>добар дан</b>" -- correctly
> displays the first word, second word is gibberish
> set the htmlText of field "Field 1" to uniencode("<b>добар дан</b>",
> "utf8") -- displays complete gibberish
>
> SO: what would be the correct syntax for displaying Unicode in
> htmlText? and how do I make sure that both English and non-English
> strings are displayed properly?
HTMLtext works for me here, but only via another field.
I saved your example in TextEdit as plain-text (coding UTF16, when set
to UTF8, all the text turns to "chinese" in RR?),
and imported it into a field
...
set the unicodetext of fld 1 to url("binfile:toma.txt")
...
And could then set the htmltext of any field to any chunk of that field
like
set the htmltext of fld 2 to the htmltext of line 1 of fld 1
etc...
Hope that helps...
> All best,
> Toma
Regards
Klaus Major
klaus at major-k.de
www.major-k.de
More information about the use-livecode
mailing list