Le 22/02/2014 à 21:24, Christopher Stone < email@hidden> a écrit : On Feb 22, 2014, at 13:54, koenig.yvan < email@hidden> wrote: And if the character to test is "é" or "È" your handler will respond nothing.
______________________________________________________________________
Hey David,
Yvan is right, but he doesn't give you the alternative.
id of x and character id x are the canonical way of doing things these days.
set ch1 to "é" set ch2 to "È"
set id1 to id of ch1 set id2 to id of ch2
set char1 to character id id1 set char2 to character id id2
-- Best Regards, Chris
Hello Christopher
Using character ID versus ASCII character isn't sufficient because we can't define a range of UPPERCASE versus a range of lowercase.
This is why I choose to rely upon a serious case converter.
Here is the compact one.property
useASObjC_Runner : true # true = use ASObjC Runner # false = use python (available in the box)
my whichCase("œ")
#=====
on whichCase(aChar) if useASObjC_Runner then tell application "ASObjC Runner" to set maybe to modify string aChar so it is caps else set python_script to "import sys; print sys.argv[1].decode('utf8').upper().encode('utf8')" set maybe to do shell script "/usr/bin/python -c " & quoted form of python_script & " " & quoted form of aChar end if considering case set maybe to maybe = aChar end considering if maybe then "upper" else "lower" end if display dialog "Character '" & aChar & "' is " & result & " case" end whichCase
#=====
Graphical chars will be treated as UPPERCASE ones.
Yvan KOENIG (VALLAURIS, France) samedi 22 février 2014 21:35:13
|