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: Sun, 19 Dec 2004 17:55:51 +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).
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