Rép: Can I map custom characters to normal uppercase equivalents?
Rép: Can I map custom characters to normal uppercase equivalents?
- Subject: Rép: Can I map custom characters to normal uppercase equivalents?
- From: KOENIG Yvan <email@hidden>
- Date: Mon, 14 Jun 2010 17:39:12 +0200
Le 14 juin 2010 à 11:37, Tommy Bollman a écrit :
Hello.
I'm about being finished with catch all case conversion and
identifying handlers for unicode text with AS.
There are however still some mapping to be done.
See: http://en.wikipedia.org/wiki/List_of_Unicode_characters
I have some questions
Can I for instance map the lowercase character Latin Small Letter
C with curl : "ɕ" ( utf value 0255) to "C"?
— Will this be right for any cases you know of in particular?
-I can't say I have seen this in any Germanic language which I
speak, read and write.
And can I do this in all similar cases? And finally: is there any
exceptions to this?
This question is for you fancy Roman descended and Non Northern
Germanic language users: Hungarian, Finnish, Polish, French,
Italian, Spanish and so on.
Please do share your expertise with me. I would like to make as
good case conversion routines as possible, and can't do without you.
From my point of view, agood case converter must be reversible.
What you are describing isn't.
I wrote a short script which builds a Numbers table embedding the
unicodes chars from 0 to 65535.
It also contain the uppercased ones resulting fdrom the UPPERCASE()
function.
It lists what must be achieved.
Here is the script :
--{code}
--[SCRIPT Uncodes2uppercase]
on run
set IFERROR_loc to my getLocalizedFunctionName("Numbers", "IFERROR")
& "("
set CHAR_loc to my getLocalizedFunctionName("Numbers", "CHAR") & "("
set UPPER_loc to my getLocalizedFunctionName("Numbers", "UPPER") & "("
set delim to my getLocalizedDelimiter()
tell application "Numbers" to tell document 1 to tell sheet 1 to
tell table 1
set c_cnt to column count
repeat (128 - c_cnt) times
add column after last column
end repeat
repeat with r from 1 to 1023
add row below last row
end repeat
repeat with r from 1 to 1024
tell row r
repeat with c from 1 to 127 by 2
set value of cell c to "=" & IFERROR_loc & CHAR_loc & (r - 1 +
((c - 1) * 512)) & ")" & delim & quote & quote & ")"
set value of cell (c + 1) to "=" & UPPER_loc & (name of cell c)
& ")"
end repeat -- c
end tell -- row r
end repeat -- r
end tell
end run
--=====
on decoupe(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 oTIDs
return l
end decoupe
--=====
(*
Useful to get function's localized name if we need to build formulas
examples:
set OFFSET_loc to my getLocalizedFunctionName("Numbers", "OFFSET")
set ADDRESS_loc to my getLocalizedFunctionName(theApp, "ADDRESS")
set INDIRECT_loc to my getLocalizedFunctionName(theApp, "INDIRECT")
*)
on getLocalizedFunctionName(theApp, x)
return my getLocalizedName(theApp, x, (path to application support
as text) & "iWork '" & my get_iWorkNum(theApp) &
":Frameworks:SFTabular.framework:Versions:A:Resources:")
end getLocalizedFunctionName
--=====
on getLocalizedName(a, x, f)
tell application a to return localized string x from table
"Localizable" in bundle file f
end getLocalizedName
--=====
(*
Set the parameter delimiter which must be used in Numbers formulas
*)
on getLocalizedDelimiter()
if character 2 of (0.5 as text) is "." then
return ","
else
return ";"
end if
end getLocalizedDelimiter
--=====
on get_iWorkNum(a)
local verNum
tell application a to set verNum to item 1 of my decoupe(get
version, ".")
if (a is "Numbers" and verNum is "2") or (a is "Pages" and verNum is
"4") then
return "09"
else
return "11"
end if
end get_iWorkNum
--=====
--[/SCRIPT]
--{code}
It requires a lot of time to achieve the task.
So, I uploaded the Numbers document and a PDF version in my idisk.
If someone is interested, go to my idisk :
<http://public.me.com/koenigyvan>
download :
unicodesƒ.zip
It's a 10.6 Mbytes archive.
Yvan KOENIG (VALLAURIS, France) lundi 14 juin 2010 17:35:36
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden