java - Convert escaped Unicode character back to actual character -


i have following value in string variable in java has utf-8 characters encoded below

dodd\u2013frank 

instead of

dodd–frank 

(assume don't have control on how value assigned string variable)

now how convert (encode) , store in string variable?

i found following code

charset.forname("utf-8").encode(str); 

but returns bytebuffer, want string back.

edit:

some more additional information.

when use system.out.println(str);

dodd\u2013frank 

i not sure correct terminology (utf-8 or unicode). pardon me that.

try

str = org.apache.commons.lang3.stringescapeutils.unescapejava(str); 

from apache commons lang


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -