Hi , thanks a lot for your help. We followed your advice, but we're still having trouble. Here you are what we did and the results we obtained.
Client side: 1. user inserts into html form the following string :" euro € ". 2. the javascript which manages the form converts, using function "encodeURI", the string in UTF-8 format: string becomes "euro%20%E2%82%AC" 3. URI is sent to WEB Server. The HttpServletRequest so becomes : http:/my_host:my_port/my_jsp.jsp?my_text=euro%20%E2%82%AC Server Side: In the bean of the JSP we do: String my_text =request.getParameter("my_text"); System.out.println(my_text) produces "euro Ô?¼ " then we followed your hint: byte[] stringBytesISO = my_text.getBytes("ISO-8859-1"); String new_text = new String(stringBytesISO, "UTF-8"); Now the dump (done converting the String to a byte[] and then System.out.println() of every byte of the array) of the String new _text shows the Euro symbol in the correct UTF-8 format, i.e. "128", but when we redo the System.out.println(new_text) we obtain "euro Ç". We suppose it is only a problem of System.out.println, and so we don't care about it, the big problem arises when we send back to client the String new _text to be reshown at the user in a html page. The user now sees "euro ┐" in the html page. At client side we use the function "decodeURI()" , in the javascript used for loading the data in the html page. Any suggestion? Very Thanks in advance. Tito. ----- Original Message ----- From: "Andoni" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Wednesday, March 19, 2003 1:15 PM Subject: Re: UTF-8 help needed -EURO problem. > It's a simple translation: > > try{ > byte[] stringBytesISO = strTestString.getBytes("ISO-8859-1"); > strTestString = new String(stringBytesISO, "UTF-8"); > }catch(UnsupportedEncodingException > e){System.out.println(e.getMessage());} > > > Use this to convert strTestString from what is received in the parameter > string into what you put into the database and it should work away without > any other problems. > > Andoni. > > > > ----- Original Message ----- > From: "tito santini" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, March 19, 2003 11:57 AM > Subject: UTF-8 help needed -EURO problem. > > > > Hi all, > > We're actually having the following problem with our application (which > runs > > in IE 6.0, Apache 1.3.19 - Tomcat 3.2.2): > > the application provides user with a HTML input form that allows him to > > send text to a JSP in the query string > > (i.e. it calls http://my_host:my_port/my_jsp?text=user_text ) The JSP > then > > store it into a Database. > > The problem occours when the user tries to put the euro sign ( '?' == > > xF2x82xAC) in the text. > > If, at client-side, we use the (deprecated) javascript function "escape" ( > > i.e UNICODE format), Tomcat throws an exception; > > If, otherwise, we use the javascript 1.5 function "encodeURI", Tomcat > > accepts it, but the JSP reiceives garbage from > "request.getParameter(text)". > > We found a mail of Larry Isaacs about this problem (19/02/2002), and so we > > followed the hint to add "charset=UTF-8" to the query: > > http://my_host:my_port/my_jsp;charset-UTF-8?text=user_text but I.E. told > us > > "page not found". > > Then we modify the URI, and tried with : > > http://my_host:my_port/my_jsp?charset-UTF-8&text=user_text > > but Tomcat interpreted it like any other parameter. > > > > Any hints or suggestion? > > > > Thanks in advance for your help. > > > > Tito Santini > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]