tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "THG" <...@lycos.com>
Subject Re: UTF-8 Sending Euro symbol to Servlet in Form data.
Date Mon, 17 Feb 2003 20:14:39 GMT
try the following code snippet:


String value = "<String from your form>";
try
{
    value = new String(value.getBytes("ISO-8859-1"), "UTF-8")
}
catch (Exception ex) {}

Then write the value (i. e. with a PreparedStatement) to the db.

On Mon, 17 Feb 2003 19:56:54  
 Andoni wrote:
>Actually the prepared statements couldn't help as I can get the Euro symbol
>into the database fine by hard-coding it into my statement.  It is only
>getting the information **from the form to the servlet** that is having a
>problem.
>
>
>
>Andoni.
>
>
>----- Original Message -----
>From: "THG" <thg@lycos.com>
>To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>Sent: Monday, February 17, 2003 7:42 PM
>Subject: Re: UTF-8 Sending to Database.
>
>
>> It could be, that the form data is double encoded or
>> the jdbc driver automatically encoding the data on the
>> fly. do u use prepared statements (setString())?
>>
>> what is the encoding of your dbms?
>>
>> On Mon, 17 Feb 2003 19:22:55
>>  Andoni wrote:
>> >Hello,
>> >
>> >I am trying to send a Euro symbol (  ?  ) to my database but it keeps
>being
>> >corrupted on the way to the servlet from the form on my page.
>> >
>> >When I replace the SQL string in my servlet with one which has a Euro
>symbol
>> >hard-coded it works fine and displays in my .jsp fine as the Euro symbol
>but
>> >when I submit a form from my JSP with a Euro symbol it gets corrupted
>into
>> >nonsense on the way to the servlet.
>> >
>> >Can anyone please help??
>> >
>> >Thanks,
>> >
>> >Andoni.
>> >
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>> >
>> >
>>
>>
>> _____________________________________________________________
>> Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
>> http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message