Reputation: 62444
Currently I'm running the replace like this:
.replace("®", "®")
.replace("°", "°")
.replace("™", "™")
.replace("©", "©")
But that relies on a lot to go right before I get to this point. What's a better way to do this?
Upvotes: 1
Views: 655
Reputation: 13139
You can use this utils class: http://commons.apache.org/lang/api-2.5/org/apache/commons/lang/StringEscapeUtils.html
In your particular case it will be StringEscapeUtils.escapeHtml(...)
Upvotes: 1
Reputation: 2437
org.apache.commons.StringEscapeUtils.escapeHtml looks like it does what you want.
Upvotes: 2