How to put unicode text into a field?

Reinhold Venzl-Schubert r.venzl-schubert at macbay.de
Sat Nov 7 11:33:42 EST 2009


Hi Devin!

thanks for your help. I tried it with unicode, also utf8, but I failed.
I guess the problem is, that polish is not a complete other font.
There are only some charakters that are different and not part of ANSI.
Therefore a word contains unicode-charakters and ANSI-charakters.

But I was successful in using HTML. I could not use it in a tablefield  
(no TAB possible),
but with some sleight of hand I build my table-field with several  
simple fields.

:-)
Reinhold


> 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

>> 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?
>>




More information about the use-livecode mailing list