MacRoman to hex-ISO Latin 1 [was: MacRoman to ISO Latin 1 [was:...]]
MacRoman to hex-ISO Latin 1 [was: MacRoman to ISO Latin 1 [was:...]]
- Subject: MacRoman to hex-ISO Latin 1 [was: MacRoman to ISO Latin 1 [was:...]]
- From: JJ <email@hidden>
- Date: Mon, 20 May 2002 12:41:23 +0200
Cool. This is the final result:
*Do you know a smartest method for the "hex" result?*
Many thanx to both Arthur & Helmut .
JJ
__________________________
set ChartToTranslat to "a" -- a-acute
charToISOLatin1(ChartToTranslat , "ascii")
--> "7" (this is ascii character 255)
charToISOLatin1(ChartToTranslat , "dec")
--> 225
charToISOLatin1(ChartToTranslat , "hex")
--> "E1"
on charToISOLatin1(this_char, desiredResult)
if (length of (this_char as text) is not 1) then set desiredResult to ""
-- only one character or force error
this_char as Unicode text
{{coercionTrick:result}}
set convertedChar to last character of (result as string)
if desiredResult is "ascii" then
return convertedChar
else if desiredResult is "dec" then
return ASCII number of convertedChar
else if desiredResult is "hex" then
convertedChar as C string
try
result * 5
on error msg
return text from character 22 of msg to character 23 of msg
end try
else
error "The handler must be as follow:" & return & return &
"charToISOLatin1(single_string_item,string)" & return & return & "where
\"single_string_item\" is any ascii character and \"string\" is one of
\"ascii\", \"dec\" or \"hex\""
end if
end charToISOLatin1
__________________________
_______________________________________________
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.