Replacing accented characters with their entities
Replacing accented characters with their entities
- Subject: Replacing accented characters with their entities
- From: email@hidden
- Date: Tue, 09 Jan 2001 20:57:30 EST
I'm trying to build entities automatically but some lower-case accented
characters are getting the upper-case entity. I know there are Scripting
Additions for this, but I would like to avoid using any commands requiring
additional OSAX.
Original character was should be but I get
lowercase a (accent grave) ` à À
lowercase a (accent tilde) c ã Ã
lowercase a (accent umlaut) d ä Ä
lowercase a (accent ring) e å Å
lowercase c (accent cedilla) g ç Ç
lowercase e (accent acute) i é É
lowercase n (accent tilde) q ñ Ñ
lowercase o (accent tilde) u õ Õ
lowercase o (accent umlaut) v ö Ö
lowercase o (oslash) x ø Ø
lowercase u (accent umlaut) | ü Ü
Here's the script
set character list to {"‘", "’", "‚", "“", "”",
"„", "]", "}", "‰", "™", "–",
"—", "!", """, "#", "?", "%", "'", "(", ")", "*", ",", ".", "/", "0",
"1",
"4", "5", "6", "7", "8", ":", ";", "?", "@", "A", "B", "C", "D",
"E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "Q", "R",
"S", "T", "U", "V", "X", "Y", "Z", "[", "\", "_", "`", "a", "b",
"c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", ""}
set character entities to {"‘", "’", "‚", "“",
"”", "„", "†", "‡", "‰", "™",
"–", "—", "¡", "¢", "£", "¤", "¥",
"§", "¨", "©", "ª", "¬", "®", "¯",
"°", "±", "´", "µ", "¶", "·",
"¸", "º", "»", "¿", "À", "Á",
"Â", "Ã", "Ä", "Å", "Æ", "Ç",
"È", "É", "Ê", "Ë", "Ì", "Í",
"Î", "Ï", "Ñ", "Ò", "Ó", "Ô",
"Õ", "Ö", "Ø", "Ù", "Ú",
"Û", "Ü", "ß", "à", "á", "â",
"ã", "ä", "å", "æ", "ç", "è",
"é", "ê", "ë", "ì", "í", "î",
"ï", "ñ", "ò", "ó", "ô", "õ",
"ö", "÷", "ø", "ù", "ú", "û", "&uum
l;", "ÿ"}
tell application "QuarkXPress™"
activate
set measurements showing to false
tell document 1
repeat with i from 1 to number of items in character list
considering case
try
set (the text of every text of every story where it is
item i of character list) to item i of character entities
on error
end try
end considering
end repeat
end tell
end tell
But if I replace the "set (the text...." line with
find and replace text box 1 of spread 1 of document 1 all (item i of
character list) by (item i of character entities)
using ScriptMaster XT it works (but slower). All of the other entities work
perfectly. I'm stumped. Thank you for your help.
System 8.6.1
Applescript 1.3.7
Quark 3.32r5