encoding - How to encode a non-special character to HTML entity in Java -
the following code:
org.apache.commons.lang.stringescapeutils.unescapehtml("Hello World");
gives:
hello world
but i'd know how decoded string "hello world". have tried escapehtml method, encodes special characters.
but i'd know how decoded string "hello world". have tried escapehtml method, doesn't useful.
not true "anything useful"; if test string contained html special characters <,>,&, function would've turned < > , & (and change other upper iso8859-1 codes entities).
if need encode unicode entity format, iterate through string codepoints:
for (int = 0; < str.length(); i++) system.out.print("&#" + str.codepointat(i) + ";");
Comments
Post a Comment