Forums Register Login

Retrieving unicode stuff from MySQL... get load of mess...

+Pie Number of slices to send: Send
Hey!



I�m trying to make it so that my clients could use different languages when entering stuff into my froms. What I am doing right now is:



All my pages have <%@ page language="java" contentType="text/html; charset=UTF-8" at the top
When I retrieve parameters I use the following procedure:


String text = request.getParameter("text");

text = new String(text.getBytes("8859_1"),"UTF8");



This seems to work perfectly for throwing parameters from page to page. Also, it seems to work fine to ENTER stuff into MySQL (I look at mysql through GUI client, and I can see all my Unicode stuff correctly).



However, what is troubling me, is that when I retrieve that Unicode stuff from DB and try to display it, I get a whole bunch of junk on my page. Here�s how I retrieve it:




And in my JSP page I simply display name and message from the list returned by this function�

Does anyone know how to make my JSP page display my stuff correctly? I also tried doing:



<%= new String(message.getBytes("8859_1"),"UTF8") %>



But that just gives me a whole bunch of boxes instead of text.



Any help is greatly appreciated.
+Pie Number of slices to send: Send
is your browser capable and set up to display Unicode?
Many browsers won't automatically switch to another character encoding even when the HTTP headers contain a different encoding from the currently active one.
+Pie Number of slices to send: Send
If I accept input in one page, and display it in another, everything works fine (if its in Russian or English - doesnt matter)...

Even if I embedd it into my HTML or my SOurceBundles - everything works just fine...

Even when I store it into database, I can acess database with mysqlCC, and I can see the text in Russian/English in my records...

But if I retrieve stuff from database like I showed above, i get a load of crap for Russian, but everything's fine for English....
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1403 times.
Similar Threads
Running Servlets on Linux
Returning a 0 value error
JSP table pagination is not working
Paging in jsp
error showing while retrieving the data from drop down list
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:51:12.