Character encoding to HTML entities - Swedish oddity
Character encoding to HTML entities - Swedish oddity
- Subject: Character encoding to HTML entities - Swedish oddity
- From: DizzyPenguin <email@hidden>
- Date: Mon, 20 Dec 2004 17:24:50 +0000
Hi all,
I have the following routines which encode accented characters into their HTML entities. All works fine for example on an English system.
Strangely, when setting OSX language to Swedish (Svenska), something odd happens...
If a filename to be encoded contains the letter "y" (which is not at all an accented character), the script encodes the letter as if it was "ü" (u umlaut).
[EDIT]
The script compiles fine in Script Editor on the system set to Swedish language. But it's as if at runtime, the "ü" and "Ü" characters from
property accented_chars refuse to compile and are turned into "y" and "Y". Therefore the routine sees the "y" in the filename and encodes it to "ü"
The script also compiles fine in Xcode and the result is the same whether the format in Mac Roman or UTF8.
[/EDIT]
Is this a bug?
Is there a way around this?
property accented_chars : (
characters of "&àáâãäåæçèéêëƒìíîïıñòóôõöøœùúûüÿßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØŒÙÚÛÜ…–—"
as Unicode text)
property encoded_accented_chars : {"&", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ƒ", "ì", "í", "î", "ï", "ı", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "œ", "ù", "ú", "û", "ü", "ÿ", "ß", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Œ", "Ù", "Ú", "Û", "Ü", "…", "–", "—"}
set x to "y"
my x)
on the_filename)
considering case
return (
my the_filename,
accented_chars,
encoded_accented_chars))
end considering
end encode_URL_accented_chars
on the_list,
the_delim)
my the_delim)
set the_string to (
every text item of the_list)
as Unicode text
my atid("")
return the_string
end list_to_string
on the_string,
the_delim)
my the_delim)
set the_list to (
every text item of the_string)
as list
my atid("")
return the_list
end string_to_list
on the_string,
search_string,
replace_string)
return my my the_string,
search_string)),
replace_string)
as Unicode text
end search_and_replace
on the_string,
search_strings,
replace_strings)
repeat with i from 1
to count of search_strings
set the_string to my the_string, (
item i of search_strings), (
item i of replace_strings))
end repeat
return the_string
end multiple_search_and_replace
on the_delim)
set AppleScript's
text item delimiters to the_delim
end atid
--
end of script
Regards,
Guy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Regards,
Guy
--
DizzyPenguin * autoMAC-it
email : <email@hidden>
website : <http://www.dizzypenguin.com/automac-it/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden