Unicode from Variable?

Scott Rossi scott at tactilemedia.com
Tue Nov 25 17:16:13 EST 2008


Thanks for the response Devin, but I'm still unclear how you DO anything
with the data stored in the variable item offsets, line offsets,
comparisons, etc).  A kind listmember clued me into the fact that you must
first uniEncode the thing you want to find in the variable, and I have since
found that by uniDecoding the variable I can get at my English/Roman
content.  But it seems that doing all the standard variable manipulation
we're used to is much more complex/fragile when dealing with Unicode.

In any event, thanks for the pointers to the stacks.  I found several
example stacks around the 'net (including your site), and though each seems
to have some examples that don't work properly, the majority of info is
helpful.


>> I have an external text file which was saved as UTF-16 that is read
>> into a
>> variable.  I am trying to find lineOffsets of various strings in the
>> variable text, but so far I keep getting values of 0 (not found).  I
>> have
>> tried using "set the useUnicode to true" before reading the variable
>> (and
>> without) and still get 0.
>> 
>> If I first place the text in a field (set the unicodeText of fld xyz
>> to url
>> ("binfile:" & tFile)), I am able to find the offsets.
> 
> I'm not sure what all the implications are of using offset functions
> with unicode text. That's one area I've not experimented with much.
>> 
>> 
>> So do I need to do anything to the variable text first?  Encode?
>> Decode?
>> Something else?
> 
> This is how I would do it:
> 
> put url "binfile:myUnicodeFile.utx" into myUniVar
> set the unicodeText of fld "myUniFld" to myUniVar


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design





More information about the use-livecode mailing list