bignum unicode entities in htmlText?

Richmond Mathewson richmondmathewson at gmail.com
Wed Jun 17 14:57:40 EDT 2009


The cool graphic background is a desktop image from Ubuntu 7.10 which
was grey-scaled in GIMP.  Should be lolling around somewhere in the
Ubuntu-verse.

viktoras d. wrote:
> Thanks Devin, Richmond for even more hints!
>
> Now I have my script almost working, it has to display both unicode 
> and non-unicode in the same field, so I did this:
>
> set the useUnicode to true
>   set the itemdelimiter to "&"
>
>   repeat for each item myItem in myInText
>      if ";" is the last char in myItem and "#" is the first char in 
> myItem then
>         put numtochar(char 2 to -2 of myItem) after myOutText
>      else
>         repeat for each char myChar in myItem
>            put myChar & null after myOutText
>         end repeat            end if
>   end repeat  set the unicodeText of fld "f1" to myOutText 
> unfortunately it still leaves the last unicode entity undecoded in 
> each unicode string, besides I would need special formatting of the 
> output, so I will definitely need to think more :-).
>
> Devin, the database is not mine (it belongs to the species2000 
> project), so I can not change anything what's inside, only try to 
> display its contents. Now I wonder if MySQL itself has any function to 
> do the decoding of these html entities in SELECT statement...
>
> Richmond, I still have Revolution 2.6 besides the 3.5, so I haven't 
> burnt all bridges to the old revonline repositories yet. Nice example, 
> btw. cool graphical background (where from (url) ?)!
>
> All the best and thanks again for your help!
> Viktoras
>
> Richmond Mathewson wrote:
>> People who have no access to the old version of revOnline and don't 
>> want to
>> write to me can download CKBD.rev.zip  (Chinese Typewriter) after 
>> joining the
>> RRText Tricks  Yahoo Group at:
>>
>> http://groups.yahoo.com/group/rrtexttricks/?yguid=254544547
>>
>> 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
>>>
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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