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">&#24744;&#31163;&#24320;&#35762;&#22269;</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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to