Hello
It seems that for some of us, it's difficult to enter thr Unicode era.
(1) for years, ASCII number and ASCII character are deprecated (2) he use of the functions "character id" and "id" is not sufficient to be UNICODE aware.
Here is a short piece of code which build a perfectly correct Unicode piece of text.
set texte to "Hello happy tax payers" set texte2 to "" repeat with unCarac in text of texte set unID to id of unCarac if (unID > 47) and unID < 127 then set texte2 to texte2 & character id (65296 - 48 + unID) else set texte2 to texte2 & unCarac end if end repeat
I used it to build the original text in the different answers posted here. Only three codes treated it correctly.
Using alphabetic order, they are : the one triggering ASObjC Runner the one triggering Python the two triggering Satimage
The other ones rely on old habits : treating characters in the range id 48 thru 127.
No offense intend but given the origin of these three answers, it seems that only non US users take care to the fact that English spelling isn’t the only one used on earth.
Yvan KOENIG (VALLAURIS, France) samedi 28 janvier 2012 12:21:35
|