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
set the clipboard to texte2 & "ß"
my changeCase(the clipboard as text, "upper")
set the clipboard to my supprime(result, ":")
--=====
(*
removes every occurences of d in text t
*)
on supprime(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to ""
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end supprime
--=====
(*
Le second argument peut être: "upper", "lower", "title", "capitalize"
*)
on changeCase(txt, mode)
set python_script to "import sys; print sys.argv[1].decode('utf8')." & mode & "().encode('utf8')"
set maybe to do shell script "/usr/bin/python -c " & quoted form of python_script & " " & quoted form of txt
if mode is "upper" and maybe contains "ß" then
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "ß"
set l to text items of maybe
set AppleScript's text item delimiters to character id 7838
set maybe to "" & l
set AppleScript's text item delimiters to oTIDs
end if
return maybe
end changeCase
--=====
This simple patch can't be used to the two other languages because the script can't decide if an available SS is a sadly uppercased ß or if it's a couple of S.
I'm a bit surprised to see that the most recent Python available in my copy of Lion 10.7.2 is version 2.7 when there is an official version 3.2.2 released on September 4th, 2011.