You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tremal Naik <tr...@gmail.com> on 2007/04/03 14:33:24 UTC

Euro symbol

Hello,
I have problems with the encoding of the euro symbol.
I set the charset to UTF-8 in my page:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

I submit a form containing the euro symbol in a client account number
text field (typed in Internet Explorer in a Windows environment).

I set a breakpoint on
org.apache.coyote.http11.Http11Processor.process() and check in the
eclipse debugger the org.apache.coyote.Request object which is passed
as an argument in the adapter.service(request, response) call:

encoding="ISO-8859-1"
content-type="application/x-www-form-urlencoded"

and the following is the result of some expressions:

request.getParameters().getParameter("accountNo") prints an unprintable char
URLEncoder.encode(request.getParameters().getParameter("accountNo"),"UTF-8")="%C2%80"

That is not what I expect, since the UTF-8 encoding for the EURO sign
should be %E2%82%AC (correct me if I'm wrong)

This causes some trouble since I'll save the client account number
with a different encoding then expected.

Can you clarify this to me please?

-- 
TREMALNAIK

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Euro symbol

Posted by Tremal Naik <tr...@gmail.com>.
2007/4/3, David Delbecq <de...@oma.be>:
> as the charset used to encode parameters when submitting form. One
> possible way i know to prevent such problem is
> 1) set page encoding to utf-8
> 2) in the <form> tag add an acceptCharset="UTF-8" parameter
> 3) call request.setCharacterEncoding("UTF-8") before getting your first
> parameter.


Thanks

-- 
TREMALNAIK

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Euro symbol

Posted by Martin Gainty <mg...@hotmail.com>.
Tremal--

A quick follow-up on david's comment
tomcat default encoding is UTF-8 unless of course you use an alternative jsp 
compiler (such as jikes)
doc available at
http://tomcat.apache.org/tomcat-5.0-doc/jasper-howto.html
Are you using an alternate jasper compiler?

----- Original Message ----- 
From: "David Delbecq" <de...@oma.be>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, April 03, 2007 9:20 AM
Subject: Re: Euro symbol


> Hi,
> most probably one of those is happening
>
> 1) IE sends form in iso-8859-1 and tomcat decodes it in UTF-8, resulting
> in wrong character
> 2) IE sends form in UTF-8 and tomcat decodes it in ISO-8859-1
>
> Be aware that the charset of current page is not always used by browser
> as the charset used to encode parameters when submitting form. One
> possible way i know to prevent such problem is
> 1) set page encoding to utf-8
> 2) in the <form> tag add an acceptCharset="UTF-8" parameter
> 3) call request.setCharacterEncoding("UTF-8") before getting your first
> parameter.
>
>
> En l'instant précis du 03/04/07 14:33, Tremal Naik s'exprimait en ces
> termes:
>> Hello,
>> I have problems with the encoding of the euro symbol.
>> I set the charset to UTF-8 in my page:
>>
>> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>>
>> I submit a form containing the euro symbol in a client account number
>> text field (typed in Internet Explorer in a Windows environment).
>>
>> I set a breakpoint on
>> org.apache.coyote.http11.Http11Processor.process() and check in the
>> eclipse debugger the org.apache.coyote.Request object which is passed
>> as an argument in the adapter.service(request, response) call:
>>
>> encoding="ISO-8859-1"
>> content-type="application/x-www-form-urlencoded"
>>
>> and the following is the result of some expressions:
>>
>> request.getParameters().getParameter("accountNo") prints an
>> unprintable char
>> URLEncoder.encode(request.getParameters().getParameter("accountNo"),"UTF-8")="%C2%80"
>>
>>
>> That is not what I expect, since the UTF-8 encoding for the EURO sign
>> should be %E2%82%AC (correct me if I'm wrong)
>>
>> This causes some trouble since I'll save the client account number
>> with a different encoding then expected.
>>
>> Can you clarify this to me please?
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Euro symbol

Posted by David Delbecq <de...@oma.be>.
Hi,
most probably one of those is happening

1) IE sends form in iso-8859-1 and tomcat decodes it in UTF-8, resulting
in wrong character
2) IE sends form in UTF-8 and tomcat decodes it in ISO-8859-1

Be aware that the charset of current page is not always used by browser
as the charset used to encode parameters when submitting form. One
possible way i know to prevent such problem is
1) set page encoding to utf-8
2) in the <form> tag add an acceptCharset="UTF-8" parameter
3) call request.setCharacterEncoding("UTF-8") before getting your first
parameter.


En l'instant précis du 03/04/07 14:33, Tremal Naik s'exprimait en ces
termes:
> Hello,
> I have problems with the encoding of the euro symbol.
> I set the charset to UTF-8 in my page:
>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>
> I submit a form containing the euro symbol in a client account number
> text field (typed in Internet Explorer in a Windows environment).
>
> I set a breakpoint on
> org.apache.coyote.http11.Http11Processor.process() and check in the
> eclipse debugger the org.apache.coyote.Request object which is passed
> as an argument in the adapter.service(request, response) call:
>
> encoding="ISO-8859-1"
> content-type="application/x-www-form-urlencoded"
>
> and the following is the result of some expressions:
>
> request.getParameters().getParameter("accountNo") prints an
> unprintable char
> URLEncoder.encode(request.getParameters().getParameter("accountNo"),"UTF-8")="%C2%80"
>
>
> That is not what I expect, since the UTF-8 encoding for the EURO sign
> should be %E2%82%AC (correct me if I'm wrong)
>
> This causes some trouble since I'll save the client account number
> with a different encoding then expected.
>
> Can you clarify this to me please?
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org