Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Escape all special characters in HTML  RSS feed

 
Scott Selikoff
author
Bartender
Posts: 4081
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is there a simple (built-in) method in java for escaping a string containing special characters to HTML? I came across this page which is useful but not complete. There's a couple hundred in this table that I would like to add. Right now, my only solution is to manually edit the text of the first page to include more of the codes of the second, but I feel like I'm re-inventing the wheel.

Is there a better way to do this?

-Scott
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott,
Have you looked at Apache Commons. Not built in, but reusable. It sounds like StringEscapeUtils has what you want.

[edited to fix typo]
 
Scott Selikoff
author
Bartender
Posts: 4081
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! I'll give it a shot and see.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!