On 2007-11-21, at 07:43, Skeeve wrote: KOENIG Yvan wrote: Thanks I tested it with
set elan to quoted form of "élan, it's virtues are elegant kœnig lætitia ;-)"
and got a perfect:
"ÉLAN, IT'S VIRTUES ARE ELEGANT KŒNIG LÆTITIA ;-) élan, it's virtues are elegant kœnig lætitia ;-) Élan, it's virtues are elegant kœnig lætitia ;-)"
replace the ;-) with a ;-} and you'll get the empty string again.... As I said: Another flaw.
Sorry for the delayed reply,
Here are two other versions for you to sneak verboten Tcl characters into.
#1 is what I prefer because there is no disk hit and can be altered to process a number of strings.
#2 is the disk hit version and will probably always be correct because it's essentially doing the same thing as the perl options in the handlers you forwarded -- save for the likelihood that perl probably mmaps the file.
Test String:
set val to quoted form of "bjOrKeD ](ü'r`} [k$édx " -- 1.
set upper to do shell script "tclsh <<< 'set s [lindex $argv 1];puts [string toupper $s]' - " & val set lower to do shell script "tclsh <<< 'set s [lindex $argv 1];puts [string tolower $s]' - " & val set title to do shell script "tclsh <<< 'set s [lindex $argv 1];puts [string totitle $s]' - " & val upper & return & lower & return & title
-- 2.
set upper to (do shell script "echo -n " & val & " > /tmp/tmp.txt;tclsh <<< 'set f [open /tmp/tmp.txt];set s [read $f];close $f;puts [string toupper $s];'") set lower to (do shell script "echo -n " & val & " > /tmp/tmp.txt;tclsh <<< 'set f [open /tmp/tmp.txt];set s [read $f];close $f;puts [string tolower $s];'") set title to (do shell script "echo -n " & val & " > /tmp/tmp.txt;tclsh <<< 'set f [open /tmp/tmp.txt];set s [read $f];close $f;puts [string totitle $s];'") upper & return & lower & return & title
|