On Aug 19, 2013, at 1:59 PM, J. Landman Gay wrote:

> On 8/19/13 2:43 PM, Devin Asay wrote:
> 
>>> When I run uniEncode(tData,"UTF8") on it, the high-ascii characters
>>> are in the variable watcher as "+" and an unprintable box. Can I
>>> assume the real character is in there? Will it work for text
>>> chunking, etc? When I split it into an array, will the keys be
>>> intact?
>> 
>> I would do all of the chunking and splitting before you do uniEncode.
>> Think of UTF8 as a reliable storage format, and only convert them
>> when you are ready to display them.
> 
> I can't. I need to do lookups on the keys. The keys have to match the
> text as it is displayed in fields.
> 
> Basically, I'm storing a glossary. The keys are the glossary terms, some
> of which are unicode. The definitions are the elements. The user points to a 
> word in a field and I need to retrieve the definition by matching the 
> displayed field text (which is unicodetext) with the glossary key.
> 
> I can't make it work.

Try this:

When the user selects the text to look up, convert it to utf8 then do the 
lookup on the utf8 text. UTF8 is just ASCII chars, so chunking and searches 
should work fine. 

Something like this should work:
User clicks term to look up.
   get the text of the click line -- this will be displayed as UTF16
   put unidecode(it,"utf8") into tSearchStr
   put glossaryArray[tSearchStr] into tDefinitionUTF8
   set the unicodeText of fld "definition" to uniencode(tDefinitionUTF8,"utf8")

This is not tested, but I've done things similar to this before with good 
success.

HTH

Devin

Devin Asay
Learn to code with LiveCode University
http://university.livecode.com




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to