I am facing one problem with thai character encoding. I have some jsp pages for a mobile web application where I show some static thai text and some text is being fetched from Database tables. I am using Content-Type as "text/html; charset=utf-8".
The problem is the static thai text is appearing properly on mobile browsers but the text, fetched from database is not proper. its apearing like this "ÃËÑÊ»ÃÐ¨ÓµÑÇ" (This is the thai encoding I guess saved in database)
What could be the solution for this ?
If I use the static thai text in jsps as TIS-620 encoding and Content-Type as "text/html; charset=TIS-620". Than static and DB thai text both is coming properly. But only for some mobile browsers. May be these browsers support TIS-620 and others dont.
I have checked about java.nio.charset package, but could not find any working example over the net to convert TIS-620 text "ÃËÑÊ»ÃÐ¨ÓµÑÇ" to UTF-8.
is it possible to convert text from one charset encoding to other ?
Please help me. If I could not make you all understand the problem properly please let me know.
my problem is how to convert data into utf-8 to be shown on browser.
Are you encountering an actual problem? Assuming that the DB charset is configured correctly, and you're using JDBC to access the DB, then what you get from the DB should be standard Java strings that you can just print to the JSP page (assuming that's correctly configured to show UTF-8).
Nitin D Gaur
posted 9 years ago
The String which I am getting from DB is like this "¸¹Ò¤ÒÃ¡ÃØ§à·¾" this is actually thai encoding in TIS-620 or windows-874..... I cant change DB data or conf.
what I need do is to convert this string to UTF-8, so that it could be shown on Browser.
I know that this can be done through java.nio.charset. But how I am not able to figure out.
posted 9 years ago
Are you certain that it is stored correctly in the DB? A DB is configured for one -and only one- charset; which one is that in your case? You can't store data in various different charsets in a DB and expect it to get out correctly.