• 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: 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 "&uuml;"

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 : {"&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

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

  • Follow-Ups:
    • Re: Character encoding to HTML entities - Swedish oddity
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Stop a script at a certain time?
  • Next by Date: Re: Character encoding to HTML entities - Swedish oddity
  • Previous by thread: Character encoding to HTML entities - Swedish oddity
  • Next by thread: Re: Character encoding to HTML entities - Swedish oddity
  • Index(es):
    • Date
    • Thread