Bug : string.utf16ToAnsi strips off the last character
Alain Content
acontent at ulb.ac.be
Thu Dec 12 04:00:35 PST 2002
Hi,
I believe that there is a bug in string.utf16ToAnsi that strips off the last
character :
What I did :
1. Created a unicode 2 string with tec.ConvertText, and convert it back with
string.utf16ToAnsi, e.g.
temp.s = tec.ConvertText ("Je bois du thé et du café fort", "ISO-8859-1",
"UNICODE-2-0")
string.utf16ToANsi (temp.s)
Result :
"Je bois du thé et du café for"
2. Created a unicode string with applescript, trap it in Frontier, and
convert it with either tec or string.utf16TOAnsi :
In Frontier, at system.verbs.traps.misc.dosc, inserted after handler line
temp.utext = s
In Smile :
set theString to "Je bois du thé chaud et du café fort" as Unicode text
tell application "UserLand Frontier" to Do Script theString
In Frontier, quickScript window :
string.utf16TOAnsi (temp.utext)
>>"Je bois du thÈ chaud et du cafÈ for"
tec.Unicode2StyledText (temp.utext, "UNICODE-2-0", 2)
>>"Je bois du thé chaud et du café for"
Note the missing "t" in utf16ToAnsi results.
Thanks,
Alain
More information about the Frontier-Users
mailing list