• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Character encoding to HTML entities - Swedish oddity
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 : {"&amp;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&fnof;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&#305;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&oslash;", "&oelig;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yuml;", "&szlig;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&Oslash;", "&OElig;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&hellip;", "&ndash;", "&mdash;"}

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

  • Prev by Date: Re: do shell script - quotation marks problem
  • Next by Date: Fwd: poking at a cross OS network connection
  • Previous by thread: Re: GUI - set size, position window
  • Next by thread: Character encoding to HTML entities - Swedish oddity
  • Index(es):
    • Date
    • Thread