unicode from a rev cgi
devin_asay at byu.edu
Wed Dec 31 11:04:17 CST 2008
On Dec 31, 2008, at 6:39 AM, Jim Sims wrote:
> I have a rev cgi that saves text from a form in a web page.
> I am testing the input of a language that requires unicode into that
> (the example I am using is the Greek word for small horse "μικρό
> The cgi saves that text to a text file from which I can retrieve it.
> It looks like this after I get the url that contains it from the
> After I urldecode the above, it looks like this:
> μικρό άλογο
> How would I change the unicode shown above back into the original
> Greek text?
> [those appear to be the correct chars - if I do this locally and then
> save those
> Greek words with the htmlText, they are the same items (in addition to
> html formating tags, of course)]
If you get the text back as html entities like this you may have to
add in the font tags in your scripting. It would probably be
sufficient to note which tags are added when you do it locally and
prepend/append them. The one trick is that the space character is not
unicode, so you'd have to surround each word by font tags. Here's
what I came up with when I did a quick test (beware line wrapping):
put "μικρό άλογο"
repeat for each word tWord in decodedText
put "<font face=" "e& "Geneva" "e && "lang=" "e&
"en-UC" & quote & ">" before tWord
put "</font>" after tWord
put tWord & space after taggedText
put taggedText--> yields: <font face="Geneva" lang="en-
UC">μικρό</font> <font face="Geneva" lang="en-
set the htmltext of fld 1 to taggedText
(Ugly, I know, but it works.)
As an alternative, would it be possible to encode the unicode text
from the form as UTF-8 before saving it to the text file? At least it
would be a bit cleaner that way.
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode