Re: unicode escape sequences in AppleScript strings
Re: unicode escape sequences in AppleScript strings
- Subject: Re: unicode escape sequences in AppleScript strings
- From: "Arthur J. Knapp" <email@hidden>
- Date: Wed, 15 Jan 2003 13:48:32 -0500
>
Subject: Re: unicode escape sequences in AppleScript strings
>
From: "Arthur J. Knapp" <email@hidden>
I said:
>
-- replace << and >> with option-\ and option-shift-\
>
set myUnicodeChar to IntegerToUnicodeChar(8482) -- trademark
>
set myUnicodeChar to IntegerToUnicodeChar(8226) -- bullet
>
property ksUsrfUtxt : ({{p:<<data utxt0000>>}} as string)'s text 1 thru -3
>
on IntegerToUnicodeChar(i)
>
set c4 to ({{p:i}} as string)'s text -2 thru -1
>
return ((my ksUsrfUtxt & c4) as record)'s p
The above wasn't handling ascii characters correctly, so let's try
this, (which should be somewhat more robust, under classic anyway):
-- replace << and >> with option-\ and option-shift-\
set myUnicodeChar to IntegerToUnicodeChar(8482) -- trademark
set myUnicodeChar to IntegerToUnicodeChar(8226) -- bullet
set myUnicodeChar to IntegerToUnicodeChar(65) -- "A"
set myUnicodeChar to IntegerToUnicodeChar(90) -- "Z"
set myUnicodeChar to IntegerToUnicodeChar(97) -- "a"
set myUnicodeChar to IntegerToUnicodeChar(122) -- "z"
on IntegerToUnicodeChar(i)
set h1 to IntegerToHexChar(i div 256)
set h2 to IntegerToHexChar(i mod 256)
run script ("<<data utxt" & h1 & h2 & ">> as Unicode text")
end IntegerToUnicodeChar
on IntegerToHexChar(i)
set x to i div 16 + 1
set y to i mod 16 + 1
tell "0123456789ABCDEF" to return item x & item y
end IntegerToHexChar
{ Arthur Knapp, of <
http://www.STELLARViSIONs.com>
a r t h u r @ s t e l l a r v i s i o n s . c o m
"Safe the Nature" - political graffiti in Prague
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.