0

Our XML feed gives us encoded UTF-8 characters inside ISO-8859-1 a file. This is being fed into the database. So the text is ISO-8859-1 encoded and contains following stuff:

金融市场

Is there a way to convert that into a normal Java string? Similar to:

String str = fromHtmlUtf8("金融市场");

Where resulting str will contain normal UTF8 chars. Chinese in this case, but can be quite mixed.

Thanks.

1

2 Answers 2

3

You can use the StringEscapeUtils from Apache Commons: http://commons.apache.org/lang/api-2.6/org/apache/commons/lang/StringEscapeUtils.html

next time search before: How to convert from HTML to UTF-8 in java

Sign up to request clarification or add additional context in comments.

1 Comment

Great people think alike. I was looking at that same page literally just now. Thanks!
0

If you need small lib for this, you can use HTMLEntitles

http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=htmlentities

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.