This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Encoding HTML  RSS feed

 
Jesper Ottosson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java, is there any equivalence of ASP's Server.HTMLEncode method, which replaces a strings all special characters to their html counterparts (e.g "<" to "<")?
btw, yes, I know I could do it myself, but... I don't wanna
/ Jesper
 
Matt Williams
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what I use:
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heh, foiled by the old "double-escape" problem...
Try this...

Alternatively, if you suck into an XML Document as a Text Element, I think it does the conversion for you... (just as a suggestion, it wouldn't be the correct thing to do, but it IS a short cut)
Dave.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!