Ok, here's what I have so far (I have yet to test this):

Code:
#!/usr/bin/gawk -f
{
        ## some html escapes:
        gsub(">",">")
        gsub("&lt;","<")
        gsub("&quot;","\"")
        gsub("&amp;","\\&")

	## replace fancy "smart" quotes with straight equivalents
        gsub("’","'")
        gsub("‘","'")
        gsub("“","\"")
        gsub("”","\"")
		
	## backquote to apostrophe
	gsub("`","'")	

	## double quote to apostrophe
        gsub("\"","'")
		
	## select illegal filename characaters replaced by alternates  (other illegal characters just dropped later)
        gsub(">",")")
        gsub("<","(")
        gsub("[:]"," - ")
        gsub("[/]","-")
		## backslash to dash
	gsub("\\\\","-")
	
        ## double space to single space:
        gsub("  "," ")


        ## sanitize the rest:
        gsub("[^- 'a-zA-Z0-9 _$+&={}\\[\\]()%@!;,.]*","")

        ## dump it to stdout
        print
}


What's an easy way to strip leading and trailing whitespace? That's about all that's left to do (just in case, but strictly for beautifying).
_________________________
Bruno
Twisted Melon : Fine Mac OS Software