bignum unicode entities in htmlText?

Richmond Mathewson richmondmathewson at gmail.com
Tue Jun 16 14:20:45 EDT 2009


Thanks to Devin's advice, a cup of Arabic coffee with Cardamon, Bach 
played by Hans Wurman
on the Moog, a knock on the head when I was 3 months old, a . . . .

Those of you who have the 'benefit' of access to the old version of 
revOnline can now
download my "Chinese Typewriter" (find it, oddly enough, under 
'Richmond'); a proof
of concept stack that shows how Chinese characters can be entered into a 
unicode
textField and an html textField with nearly no headaches at all (well, 
except the huge
psychological overhead of learning Chinese characters to start with).

And, modest chap that I am, I have to say it's Really Very Good!

Mind you, I couldn't repeat all those & quote & s to save my life!

Those of you (tut,tut) who burnt your bridges behind you when you bought 
RR 3.5 will have
ask me "pretty Please" to bung you a zipped attachment to an off-list 
e-mail message.

Devin Asay wrote:
>
> On Jun 12, 2009, at 2:31 PM, viktoras d. wrote:
>
>> sorry if I missed a possible hint in any of the previous threads on
>> unicode. I am having trouble making Revolution correctly display bignum
>> unicode entities like unicode characters of Mandarin Chinese. In mysql
>> database all the unicode strings are encoded with leading ampersand and
>> trailing semicolon like this: 西方黃黝魚
>> These get correctly rendered in any web browser, but Revolution fails to
>> display them correctly in a field (I am seting htmltext of field).
>>
>> Is there any way to fix this?
>
> Viktoras,
>
> I'm jumping in here late, but wanted to add, when you save your 
> HTMLtext with Chinese characters, you need to make sure than all of 
> the font tags are saved with it. It seems that when you're using 
> Unicode embedded in HTML you also have to tell Rev exactly what font 
> and language to use to display it. It ends up coming out something 
> like this:
>
> <p><font face="Kai" size="16" 
> lang="zh-CN">您离开讲国</font></p>
>
> The font face attribute will of course determine the exact font, 
> therefore the look of the characters. Make sure it's a font that you 
> can reasonably assume will be on the target computer. The font lang 
> attribute determines which variant of Chinese you use, Simplified 
> (mainland) or Traditional (Taiwan primarily). For Simplified use 
> lang="zh-CN". For Traditional use lang="zh-TW". Note that Simplified 
> and Traditional Chinese fonts are not interchangeable. There are 
> Traditional font faces and Simplified font faces.
>
> By the way, here's how to get a list of Simplified vs. Traditional 
> fonts on your computer:
>
>    put the fontNames into tfonts
>    repeat for each line tFont in tfonts
>       if the fontLanguage of tFont is "SimpleChinese" then
>       -- or use this test to find Trad.
>       -- if the fontLanguage of tFont is "Chinese" then
>          put tFont & cr after tList
>       end if
>    end repeat
>
> Having said all that, it might be better in the long run to store your 
> Chinese text in your database as UTF-8. To do so, just put your 
> unicode text into a variable and upload it to a database:
>
>   put unidecode(the unicodeText of fld "MyUniFld","UTF8") into myVar
>   ## store the contents of myVar in the database
>
> Then when you are retrieving it, you reverse the process. (You have to 
> make sure that the textFont for the destination field is set to a 
> unicode-compatible font first. Usually if you just put it back into 
> the field you got it from it's fine.)
>
>   set the unicodeText of fld "myUniFld" to uniencode(myDataFromDB,"UTF8")
>
> As I've said before, Unicode and Rev play together fairly nicely if 
> you understand some basic concepts and know Rev's quirks. See my 
> article at http://revolution.byu.edu/unicode/unicodeInRev.php for more 
> details.
>
> Regards,
>
> Devin
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list