Unicode from Variable?
Scott Rossi
scott at tactilemedia.com
Mon Nov 24 19:56:45 EST 2008
Recently, Devin Asay wrote:
>> Anyone know if it's possible to set the unicodeText of a field to data
>> contained in a variable? So far all the examples I've found involve
>> setting
>> the unicodeText from an external binary file, or setting the
>> unicodeText of
>> one field to the unicodeText of another.
>
> Yes, you can do this. All you have to do is make sure that the
> variable contains valid unicode text, then do:
>
> set the unicodeText of fld "babel" to varFullOfUnicode
>
> It works with custom properties, too.
>
> set the unicodeText of fld "babel" to the uniStoredText of me
>
> As Mark said, if it's not already uni-encoded you have to run it
> through uniencode() first.
I guess I'm not understanding when text should or should not be "encoded".
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.
So do I need to do anything to the variable text first? Encode? Decode?
Something else?
Man this stuff takes a lot of time....
Thanks & Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
More information about the use-livecode
mailing list