utf 8 - How to convert between UTF-8 and native String in Java? -


enter image description here

just picture, i'd convert between encoded utf-8 string , native string in java. suggestions? lot!

ps. example,

string = "这是一个例子,this example"; string b = null; // block a: processing a, , let b = "这是一个例子,this example" 

how implement "block a"?

apache commons lang stringescapeutils.unescapexml(...) want. depending on original string came from, 1 of html variants may more appropriate.

use so:

string = "这是一个例子,this example"; string b = stringescapeutils.unescapexml(a); // block a: processing a, , let b = "这是一个例子,this example" system.out.println(a); system.out.println(b); 

output:

这是一个例子,this example 这是一个例子,this example 

there methods converting other way also.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -