The special in-document LaTeX symbols like percent sign or dollar sign
are "
session, these will appear as double-backslashed symbols, while in
a saved text file, there will only be the one desired slash.
If type = "html", we only clean up <, >, / and &, and quote
characters. If document is in unicode, we don't need to do the
gigantic set anymore.
If type = "filename", then symbols that are not allowed in file
names, such as "\", "*", are replaced. Do not use this on a
full path, since it will obliterate path separators.