This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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.
thanks for your reply, but how to take data form browser to DB is not my problem.
my problem is how to convert data into utf-8 to be shown on browser.
If i use character encoding as windows-874 or tis-620 than its possible, but some mobile browsers dont support tis-620 and windows-874. Thats why I want to make data from DB, compatible to utf-8.
Nitin
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35250
7
posted
0
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).
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.
Nitin.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35250
7
posted
0
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.