How to put unicode text into a field?
Devin Asay
devin_asay at byu.edu
Thu Nov 5 13:04:59 EST 2009
On Nov 5, 2009, at 10:37 AM, Reinhold Venzl-Schubert wrote:
> Hi!
>
> Learning polish I want to use unicode text in my stack.
>
> I have a lot of cds with polish vocabularies and now I want to list
> them in a table with this code:
>
> repeat with i = 1 to num of marked cds
> if fld "VocTable" of stack "VocListing" is empty then
> put fld "German" & TAB into fld "VocTable" of stack "VocListing"
> else
> put fld "German" & TAB after fld "VocTable" of stack "VocListing"
> end if
> put fld "Polish" & CR after fld "VocTable" of stack "VocListing"
> end repeat
>
> Although in my fields the polish text is well readable in the table
> the special polish letters are transformed to unreadable special
> charakters.
>
> I studied the stack "Unicode in Revolution: Taming the Beast" by Devin
> Asay
> but I only found the code:
>
>> set the unicodeText of fld "VocTable" to the unicodeText of of fld
> "Polish" <
>
> ... but the content of my table-field is compound of the contents of
> two or two hundred fields.
>
> Do anybody knows a solution?
>
Hello Reinhold,
Since my stack didn't help you much with this problem I'll suggest
another approach. :-)
One of the difficulties in using unicode in Rev comes when mixing
ASCII and Unicode text. I can think of a couple of approaches you
could try (not tested):
1. Use UTF-8 as a transitional encoding. So, using your example:
repeat with i = 1 to the number of marked cds
put unidecode(fld "German","utf8") into tGmn
put unidecode(fld "Polish","utf8") into tPol
if fld "vocTable" of stack "vocListening" is empty then
put tGmn & tab & tPol into tCombined
else
put unidecode(fld "voctable","utf8") & tab & tCombined into
tCombined
end if
set the unicodeText of fld "vocTable" to uniencode(tCombined,"utf8")
end repeat
2. Use htmlText (not sure how or if this would work with table fields):
repeat with i = 1 to the number of marked cds
put the htmlText of fld "German" into tGmn
put the htmlText of fld "Polish" into tPol
if fld "vocTable" of stack "vocListening" is empty then
put tGmn & tab & tPol into tCombined
else
put the htmlText of fld "voctable" & tab & tCombined into tCombined
end if
set the htmlText of fld "vocTable" to tCombined
end repeat
Hope this helps.
Regards,
Devin
Devin Asay
Humanities Technology and Research Support Center
Brigham Young University
More information about the use-livecode
mailing list