Removing html entities from mail.

Hello.

I wonder if any of you have any better ide than to get the contents of a mail, and filter it for html entites, before displaying it.

I have a gmail account, and I believe the mails are sent out of some wicked exchange server, so I can’t escape the escaping of the ticks and such into html entites, through any setting, at least that is what I believe after having read the docs from gmail.

The only solution I see is to write a script that displays the filtered content of Mail.app’s mail in either a new text document or a dialog box.

If you know something better I can do, then please share.

Thanks

Edit

This does the trick for now:

tell application "Mail"
	tell message viewer 1
		set this_message to selected messages
	end tell
	set thisContent to content of item 1 of this_message
end tell

tell (a reference to text item delimiters)
	-- inserts ticks first 
	set {tids, contents of it} to {contents of it, "’"}
	set newContent to text items of thisContent
	set contents of it to "'"
	set thisContent to newContent as string
	-- smart quotes
	set contents of it to {"“", "”"}
	set newContent to text items of thisContent
	set contents of it to "\""
	set thisContent to newContent as string
	-- ndash
	set contents of it to "–"
	set newContent to text items of thisContent
	set contents of it to "-"
	set thisContent to newContent as string
	-- left single smart quote mark
	set contents of it to "‘"
	set newContent to text items of thisContent
	set contents of it to "`"
	set thisContent to newContent as string
	
	-- cleaning up
	set contents of it to linefeed & linefeed
	set newContent to paragraphs of thisContent as string
	set contents of it to tids
end tell


tell application "TextEdit"
	tell (make new document at front)
		repeat with apar in (every paragraph of newContent)
			make new paragraph at end of text of it with data (apar & linefeed & linefeed) with properties {font:"Andale Mono", size:14}
		end repeat
	end tell
end tell
do shell script "open -b \"com.apple.textedit\""