Custom props and unicode
Dar Scott
dsc at swcp.com
Thu Jun 2 12:17:13 EDT 2005
On Jun 2, 2005, at 5:27 AM, Lars Brehmer wrote:
> I've been looking like crazy in the archives for tips here, but not
> finding the answer to this. Is it posssible to store unicode text in
> a custom property? If yes, how? If no, oh well! It's simple really -
> I want to put unicode text into a customProp and then display it in a
> field. I've been trying to use useUnicode, uniEncode and uincodeText
> properties, but if one of these will do the trick, I am simply doing
> it wrong. Advice or not possible?
Here is the simplified (one platform) version.
To set it do something like this:
set the storedText of me to the unicodeText of field "Name"
To fetch it do this:
set the unicodeText of field "Name" to the storedText of me
That will be byte order dependent and will not always work across
platforms and OSes. To make that work, change those to these.
set the storedText of me to uniDecode( the unicodeText of field "Name",
"UTF8")
set the unicodeText of field "Name" to uniEncode( (the storedText of
me), "UTF8")
I didn't test the above, so there might be a goof or something I missed.
The UTF8 encoding does not lose any characters and is not dependent on
host byte order of the UTF16 you get from unicodeText.
Dar
--
**********************************************
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
Programming and software
**********************************************
More information about the use-livecode
mailing list