Is there a way to convert a string to a string that will display properly in a web document? For example, changing the string
\"\"
That's usually called "HTML escaping". I'm not aware of anything in the standard libraries for doing this (though you can approximate it by using XML escaping). There are lots of third-party libraries that can do this, however. StringEscapeUtils from org.apache.commons.lang has a escapeHtml method that can do this.