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 &lt; &gt; , &amp; (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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -