Hello Yvan,
Am 30.01.2012 um 15:59 schrieb KOENIG Yvan: Le 30 janv. 2012 à 12:19, Thomas Fischer a écrit : Hello,
I fooled around with this question a little more, trying to keep flexibility and increase speed. I would be glad to know how this compares to the other options. Shane, can you check this?
By the way, there is an error in Yvan's solution: if you
set unID to id of unCarac
then unID isn't necessarily a number: if unCarac is a combined character, then unID will be a list of numbers (check ü). I tried to take that into account.
It seems that you read too fast.
The piece of code using set unID to id of unCarac is not part of the conversion code.
I just used it to build the text to convert because I was too lazy to type it with the characters enocded in the range 65296 to 65375 and was not sure of the way it would be treated in a mail.
The conversion code itself doesn't use the id property.
I'm sorry, you're right and I want to apologise. I made this kind of error before and wanted do draw attention to it, so I overlooked the context. As Jon's one, your plain vanilla script treat only the ASCII set of characters plus 20 accented characters which isn't satisfying for a non English user. Both fail to treat a lot of characters: range $E0 to $24F range $400 to $52F range $1D00 to $1FFF range $249C to $24EA range $A720 to $A74F range $F50A to $F54D range $FF00 to $FF5f (which is the one used in my sample string) range $FB00 to $FB08 (no more treated by Python, Satimage or ASObjC Runner) range $1D400 to $1D7FF (no more treated by Python, Satimage or ASObjC Runner)
My suggestion covers ISO Latin-1, so ist also covers $E0 to $FF. In addiction, it takes care of combined characters (with ̄, ̃, ̆, ̈ etc.). But I agree, this is only a small part of the Unicode world. I use Unicode throughout and in particular with foreign languages (usually cyrillic, but also some other East European), so I am aware that my little script is completely insufficient. My point was to try to see how far and fast AppleScript can handle this kind of question without additional programming environments. I found some deeper limitations in AppleScript that I didn't expect, like exponential increase of time for list dereferencing, so I was "fooling around" in a different direction than you, where your approach is a worthwhile exercise in a different area.
All the best Thomas
|