• 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
Save some time converting umlauts and special characters to HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Save some time converting umlauts and special characters to HTML


  • Subject: Save some time converting umlauts and special characters to HTML
  • From: Martin Michel <email@hidden>
  • Date: Fri, 22 Mar 2002 00:41:49 +0100

Hi,

as I needed a HTML-export function in my AS-S app I wrote the following routine which converts umlauts and other special characters to HTML code. It took me two hours to figure it out (yes, I am an amateur) so perhaps someone can use it and save some time.

If this email is messed up I can send you an compiled and stuffed script on demand via email.

Yours,

Martin, the guy that created the famous Charts-O-Mat

--***

property SZListe : {"C", "\"", "<", ">", "B!", "B"", "B#", "B%", "B'", "B(", "B)", "B*", "B+", "B,", "B.", "B0", "B1", "B4", "B5", "B6", "B7", "B8", "B:", "B;", "B?", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C ", "C
", "C ", "C ", "C
", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C ", "C!", "C"", "C#", "C$", "C%", "C&", "C'", "C(", "C)", "C*", "C+", "C,", "C-", "C.", "C/", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C:", "C;", "C<", "C?", "b"", "b", "b"", "b,", "b", "b", "b", "b", "b", "b"}

property ESListe : {"&szlig;", "&quot;", "&lt;", "&gt;", "&iexcl;", "&cent;", "&pound;", "&yen;", "&sect;", "&uml;", "&copy;", "&ordf;", "&laquo;", "&not;", "&reg;", "&deg;", "&plusmn;", "&acute;", "&micro;", "&para;", "&middot;", "&cedil;", "&ordm;", "&raquo;", "&iquest;", "&Agrave;", "&Aacute;", "&Acirc;", "&Atilde;", "&Auml;", "&Aring;", "&AElig;", "&Ccedil;", "&Egrave;", "&Eacute;", "&Ecirc;", "&Euml;", "&Igrave;", "&Iacute;", "&Icirc;", "&Iuml;", "&Ntilde;", "&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&Ouml;", "&Oslash;", "&Ugrave;", "&Uacute;", "&Ucirc;", "&Uuml;", "&agrave;", "&aacute;", "&acirc;", "&atilde;", "&auml;", "&aring;", "&aelig;", "&ccedil;", "&egrave;", "&eacute;", "&ecirc;", "&euml;", "&igrave;", "&iacute;", "&icirc;", "&iuml;", "&ntilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;", "&ouml;", "&divide;", "&oslash;", "&ugrave;", "&uacute;", "&ucirc;", "&uuml;", "&yuml;", "&bull;", "&frasl;", "&trade;", "&euro;", "&lsquo;", "&rsquo;", "&sbquo;", "&ldquo;", "&rdquo;", "&bdquo;"}

set theText to "Whatever you like to test"

considering case, diacriticals and punctuation
if theText is not "" then
if theText contains "&" then
set oldDelims to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"&"}
set ls to text items of theText
set AppleScript's text item delimiters to {"&amp;"}
set theText to ls as string

set AppleScript's text item delimiters to oldDelims
end if

repeat with i from 1 to the count of items in SZListe
if theText contains item i of SZListe then
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to item i of SZListe
set ls to text items of theText
set AppleScript's text item delimiters to item i of ESListe
set theText to ls as string
set AppleScript's text item delimiters to oldDelims
end if
end repeat
end if
end considering

--***
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: applescript-users digest, Vol 3 #273 - 15 msgs
  • Next by Date: Download : Save some time converting umlauts and special characters to HTML
  • Previous by thread: Re: applescript-users digest, Vol 3 #273 - 15 msgs
  • Next by thread: Download : Save some time converting umlauts and special characters to HTML
  • Index(es):
    • Date
    • Thread