I have an utf-8 html form that searches in the database, and produces 
result in an utf-8 html page.

I have 2 conversion problems :

1) displaying items

When I append to the page the String received from the ejb (from mysql), 
the result is not good.
I tried all these :
           utf8name=new String(utf8bytes);
           utf8name=new String(utf8bytes,"UTF8");
           utf8name=new String(utf8bytes,"ASCII");

but nothing works. I found this operation to make it display correctly 
in utf8 :

           for (idxtmp=0;idxtmp<utf8bytes.length;idxtmp++)

but I'm not sure this is efficient. How do you convert a string to utf8 ?

2) searching items

in the form I receive a string wich is encoded in utf8 by the browser, 
but it is not recognized as utf8 by the server. I cannot convert it to 
utf8 for mysql.
I tried :

for (idxtmp=0;idxtmp<utf8bytes.length;idxtmp++)
   System.out.println("byte "+idxtmp+"="+((int)utf8bytes[idxtmp]));

this converts to unicode string, but it is send like this in 
createQuery(), while mysql expects utf8... result is empty.

How do you do these conversions ?

I looked at sun's international tutorial 
http://java.sun.com/docs/books/tutorial/i18n/text/index.html but it did 
not help.
Thanks a lot for any tip, or the good documentation.

Très cordialement,

Riccardo Cohen
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49

resin-interest mailing list

Reply via email to