Title: Re: Font Substitution (for Allen Watson)
On or near 6/6/02 8:23 AM, Remo Del Bello at [EMAIL PROTECTED] observed:

> I would gather from these headers that the reason the characters were
> transposed is because there is no encoding information in the headers of
> Allen's post. Entourage has to guess the character set and probably assumed
> "US-ASCII" whereas the original message Allen was quoting was probably in a
> different character set. The question then is "When did the character set
> headers get stripped and by whom?" It might have been MT-NewsWatcher in
> converting from HTML to plain-text or it could have been his server.

I am awed by the attention paid to all of this. If I could remember exactly what I did, I'd try to reproduce it and then to post via a different server or something. But, I am pretty certain I was posting via Earthlink even though my return address was mvps.org. I connect via Earthlink DSL, and just have Newswatcher set to use the mvps.org return address.

For me, I've never been able to avoid getting mistranslated quote characters, no matter what I do. The solution has been to write a little script that translates PC characters into Mac ones.

Here is "Fix PC Quotes" (and a few other characters):

-- Change various PC characters to Mac version, particularly curly quotes
-- Replace the current text selection or, if none, operate on contents of clipboard    
-- If there is no open message, the contents of the clipboard will be processed
tell application "Microsoft Entourage"
    activate
    -- Save clipboard contents
    set saveClip to the clipboard
    try
        
        set the clipboard to selection of the front window as text -- Copy selection to clipboard
        set theSelection to the clipboard
        set noselection to false
    on error
        try
            -- Try entire open message
            set theMsg to displayed message of the front window
            set theSelection to the content of theMsg
            set the clipboard to theSelection
        on error theErr
            display dialog theErr
        end try
        set noselection to true
    end try
    
    set newSelection to theSelection
    (* Left Double Quote *)
    set searchFor to (ASCII character (147))
    set replaceWith to (ASCII character (34))
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    (* Left Double Quote *)
    set searchFor to "�"
    set replaceWith to (ASCII character (34))
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    (* Right Double Quote *)
    set searchFor to ASCII character (148)
    set replaceWith to (ASCII character (34))
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    (* Right Double Quote *)
    set searchFor to "�"
    set replaceWith to (ASCII character (34))
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    (* Left Single Quote *)
    set searchFor to "·"
    set replaceWith to "'"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    (* Left Single Quote *)
    set searchFor to "�"
    set replaceWith to "'"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    
    (* Right Single Quote *)
    set searchFor to "�"
    set replaceWith to "'"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    (* Right Single Quote *)
    set searchFor to "í"
    set replaceWith to "'"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    (* Ligature fl *)
    set searchFor to "ü"
    set replaceWith to "�"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    (* En Dash *)
    set searchFor to ""
    set replaceWith to "-"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    (* En Dash *)
    set searchFor to "ñ"
    set replaceWith to "-"
    set newSelection to my replaceIt(searchFor, replaceWith, newSelection)
    
    -- Put it back now
    set the clipboard to newSelection
    if noselection is false then
        try
            set the selection to newSelection -- Paste it back
        on error
            display dialog "Tried to paste but could not."
        end try
        set the clipboard to saveClip
    else
        set the content of theMsg to newSelection
    end if
end tell


on replaceIt(searchStr, replaceStr, theString) -- Parameters: search, replace, the String
    set olddelis to my text item delimiters
    set my text item delimiters to (searchStr)
    tell me to set theList to (every text item of theString)
    set my text item delimiters to (replaceStr)
    set theString to theList as string
    set my text item delimiters to olddelis
    return theString
end replaceIt
--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>

Reply via email to