On 08/15/2011 10:51 PM, Malte Brill wrote:
Hey Richmond,
maybe these might come in handy:
setprop cUTF8Text pUTF8String
if word 1 of the name of the target<>"field" and word 1 of the name of the
target<>"button" then
if "dev" is in the environment then
throw "cUTF8Text: Target is not a field or Button"
end if
exit cUTF8Text
end if
if word 1 of the name of the target = "field" then
set the unicodetext of the target to uniencode(pUTF8String,"UTF8")
else
set the text of the target to uniencode(pUTF8String,"UTF8")
set the textFont of the target to ",UNICODE"
end if
end cUTF8Text
getprop cUTF8Text
if word 1 of the name of the target<>"field" and word 1 of the name of the
target<>"button" then
if "dev" is in the environment then
throw "cUTF8Text: Target is not a field or button"
end if
exit cUTF8Text
end if
if word 1 of the name of the target="field" then
return unidecode(the unicodetext of the target,"UTF8")
else
if ",UNICODE" is in the textfont of the target then
return unidecode(the text of the target,"UTF8")
end if
end if
end cUTF8Text
Keep them at stack level or in a library stack. Use them the following way:
put the cUTF8Text of field "ContainsMixedChars" into tUTF8
--> Now holds a correctly UTF8 encoded string
--> UTF8 is double byte only when needed and things like the itemdel
--> do work as expected on UTF8 text
put "aoi" after tUTF8
set the cUTF8Text of field "ContainsMixedChars" to tUTF8
I have taken these scripts from the unicode lib that I am still trying to set
up. If there is any interested, I'll upload it to revOnline and announce it on
the list.
Cheers,
Malte
Pour quoi?
_______________________________________________
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