You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by JSimas <js...@gmail.com> on 2008/10/27 19:19:50 UTC
Tomcat 6 - Problems with encoding
Hi.
I'm using Apache Tomcat 6.0.14, wich deploys a Struts 1.x web application.
I was using encoding ISO-LATIN-1 but i was having problems with the euro (€)
char. Every time that i use a € char in a text box or in a text area, when
the request arrives at struts Request Processor the value is already
deformed.
I've tried to change the encoding into UTF-8 but i also have problems.
Using a HTTP Sniffer, this is what i could gather:
HTTP Post Request into Tomcat:
POST /DRCIEWeb/drcieFlow.do2 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword,
application/x-silverlight, application/x-silverlight-2-b2, */*
Referer: http://localhost:2001/WebApp/webFlow.do2
Accept-Language: pt
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
3.0.04506.648; .NET CLR 3.5.21022)
Host: localhost:2001
Content-Length: 733
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: menuPos=%260-1%261-1; JSESSIONID=665E5243A08AF2A83D586E9181487F64
_flowExecutionKey=_cDB824BB0-C9AA-F9D1-519F-27E8542F8DE9_k82B5EDEF-9F28-712A-FBAE-5D2965221283&anoEconomico=2008&siglaDirecaoServico=&requerente.nif=&requerente.nome=&nomescgp=&ac=&processoPai=@%E2%82%AC
The bolded text is the input text wich is: @€. However the € char is encoded
using UTF-8 wich is represented by the %E2%82%AC string.
When the request arrives in the Request Processor of Struts this is the
value: @â¬
There is probably something that i should configure in Tomcat for this to
work.. however i'm completely lost!
Can anyone help me please
Thanks in advance.
Best Regards
João Simas
--
View this message in context: http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20193292.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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
Tomcat 6 - Problems with encoding - PROBLEM SOLVED
Posted by JSimas <js...@gmail.com>.
Problem solved... but i still have some doubts :p
This was my solution:
1. Remove this next lines of all JSPs (some had, others didn't)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
2. In web.xml added a CharsetFilter of Spring
<filter>
<filter-name>charsetFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>ISO-8859-15</param-value>
</init-param>
</filter>
And 3 (And here are my doubts) Added contentType into RequestProcessor of
struts in struts-config.xml
<controller processorClass="org.apache.struts.action.RequestProcessor"
nocache="true" locale="false" contentType="text/html; charset=ISO-8859-15"/>
This last item confuses me... maybe i'm doing something wrong... However
this is not a Tomcat issue so i will not bore you more with this question.
Thank you all for your help!
Best Regards
João Simas
--
View this message in context: http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20209011.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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: Tomcat 6 - Problems with encoding
Posted by Jerome Lepage - AKEROZ <j....@akeroz.net>.
Hi,
> As you can see the value Test-€-! was transformed into Test-%A4-%2.
Maybe you confuse between URL Encoding and Charset Enconding.
%xx is a URL Encoding, you have to refere to the approriate RFC for that.
(or to anyone who knows it)
And i don't see in your request header a charset defined.
Like POST /something; charset=ISO-8859-15
Personnaly, i don't believe that Open a ISO-8859-15 stream garanted all chars will be transfert in ISO-8859-15.
(or converted into), certainly because i'm paranoïd ^^
And, maybe i open a opened door too, you java encoding don't match ISO-8859-15.
In eclipse, when i print ISO-8859-1 in output, don't looks like good because output is in UTF8 (or 16).
All charset problems i had, that a "pipe" (or more) transfert was not in good charset.
I hope, i have help you a little.
Jerome Lepage
----- Original Message -----
From: "JSimas" <js...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, October 28, 2008 12:01 PM
Subject: Re: Tomcat 6 - Problems with encoding
Hi
Thanks for your quick reply. I already changed my encoding to ISO-8859-15,
however i'm still having problems.
Here is the HTTP Post Stream using ISO-8859-15:
POST /AppWeb/webFlow.do2 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword,
application/x-silverlight, application/x-silverlight-2-b2, */*
Referer:
http://localhost:2001/AppWeb/servicos.do2?tipo=25266&referer=/listarvariantes.do2?proc=25265
Accept-Language: pt
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
3.0.04506.648; .NET CLR 3.5.21022)
Host: localhost:2001
Content-Length: 704
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: menuPos=; JSESSIONID=F99DE24CEA69DA1F0F3AC119A3C1CF54
_flowExecutionKey=_c19EF91A8-4B9E-8180-7620-F3FE78E0FB33_kA94AECBD-B5EB-0DA8-2E83-0624F27D614C&anoEconomico=2008&processoPai=Test-%A4-%21
As you can see the value Test-€-! was transformed into Test-%A4-%2.
However when the request enter's the RequestProcessor of struts, if i debug
and get the value of request.getParameter("processoPai"), the result is
this:
Test-¤-!
So... i'm still stuck with this :(
Do you have any other tips Leon? Thanks for you help anyway!
Best Regards
João Simas
Leon Rosenberg-3 wrote:
>
> € sign is not part of ISO-8859-1 use ISO-8859-15 instead.
>
> regards
> Leon
>
> On Mon, Oct 27, 2008 at 7:19 PM, JSimas <js...@gmail.com> wrote:
>>
>> Hi.
>>
>> I'm using Apache Tomcat 6.0.14, wich deploys a Struts 1.x web
>> application.
>>
>> I was using encoding ISO-LATIN-1 but i was having problems with the euro
>> (€)
>> char. Every time that i use a € char in a text box or in a text area,
>> when
>> the request arrives at struts Request Processor the value is already
>> deformed.
>>
>> I've tried to change the encoding into UTF-8 but i also have problems.
>>
>> Using a HTTP Sniffer, this is what i could gather:
>>
>> HTTP Post Request into Tomcat:
>>
>> POST /DRCIEWeb/drcieFlow.do2 HTTP/1.1
>> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
>> application/x-shockwave-flash, application/xaml+xml,
>> application/vnd.ms-xpsdocument, application/x-ms-xbap,
>> application/x-ms-application, application/vnd.ms-excel,
>> application/vnd.ms-powerpoint, application/msword,
>> application/x-silverlight, application/x-silverlight-2-b2, */*
>> Referer: http://localhost:2001/WebApp/webFlow.do2
>> Accept-Language: pt
>> Content-Type: application/x-www-form-urlencoded
>> UA-CPU: x86
>> Accept-Encoding: gzip, deflate
>> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
>> 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
>> 3.0.04506.648; .NET CLR 3.5.21022)
>> Host: localhost:2001
>> Content-Length: 733
>> Connection: Keep-Alive
>> Cache-Control: no-cache
>> Cookie: menuPos=%260-1%261-1; JSESSIONID=665E5243A08AF2A83D586E9181487F64
>> _flowExecutionKey=_cDB824BB0-C9AA-F9D1-519F-27E8542F8DE9_k82B5EDEF-9F28-712A-FBAE-5D2965221283&anoEconomico=2008&siglaDirecaoServico=&requerente.nif=&requerente.nome=&nomescgp=&ac=&processoPai=@%E2%82%AC
>>
>> The bolded text is the input text wich is: @€. However the € char is
>> encoded
>> using UTF-8 wich is represented by the %E2%82%AC string.
>>
>> When the request arrives in the Request Processor of Struts this is the
>> value: @€
>>
>> There is probably something that i should configure in Tomcat for this to
>> work.. however i'm completely lost!
>>
>> Can anyone help me please
>>
>> Thanks in advance.
>>
>> Best Regards
>>
>> João Simas
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20193292.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20205114.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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: Tomcat 6 - Problems with encoding
Posted by JSimas <js...@gmail.com>.
Hi
Thanks for your quick reply. I already changed my encoding to ISO-8859-15,
however i'm still having problems.
Here is the HTTP Post Stream using ISO-8859-15:
POST /AppWeb/webFlow.do2 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword,
application/x-silverlight, application/x-silverlight-2-b2, */*
Referer:
http://localhost:2001/AppWeb/servicos.do2?tipo=25266&referer=/listarvariantes.do2?proc=25265
Accept-Language: pt
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
3.0.04506.648; .NET CLR 3.5.21022)
Host: localhost:2001
Content-Length: 704
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: menuPos=; JSESSIONID=F99DE24CEA69DA1F0F3AC119A3C1CF54
_flowExecutionKey=_c19EF91A8-4B9E-8180-7620-F3FE78E0FB33_kA94AECBD-B5EB-0DA8-2E83-0624F27D614C&anoEconomico=2008&processoPai=Test-%A4-%21
As you can see the value Test-€-! was transformed into Test-%A4-%2.
However when the request enter's the RequestProcessor of struts, if i debug
and get the value of request.getParameter("processoPai"), the result is
this:
Test-¤-!
So... i'm still stuck with this :(
Do you have any other tips Leon? Thanks for you help anyway!
Best Regards
João Simas
Leon Rosenberg-3 wrote:
>
> € sign is not part of ISO-8859-1 use ISO-8859-15 instead.
>
> regards
> Leon
>
> On Mon, Oct 27, 2008 at 7:19 PM, JSimas <js...@gmail.com> wrote:
>>
>> Hi.
>>
>> I'm using Apache Tomcat 6.0.14, wich deploys a Struts 1.x web
>> application.
>>
>> I was using encoding ISO-LATIN-1 but i was having problems with the euro
>> (€)
>> char. Every time that i use a € char in a text box or in a text area,
>> when
>> the request arrives at struts Request Processor the value is already
>> deformed.
>>
>> I've tried to change the encoding into UTF-8 but i also have problems.
>>
>> Using a HTTP Sniffer, this is what i could gather:
>>
>> HTTP Post Request into Tomcat:
>>
>> POST /DRCIEWeb/drcieFlow.do2 HTTP/1.1
>> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
>> application/x-shockwave-flash, application/xaml+xml,
>> application/vnd.ms-xpsdocument, application/x-ms-xbap,
>> application/x-ms-application, application/vnd.ms-excel,
>> application/vnd.ms-powerpoint, application/msword,
>> application/x-silverlight, application/x-silverlight-2-b2, */*
>> Referer: http://localhost:2001/WebApp/webFlow.do2
>> Accept-Language: pt
>> Content-Type: application/x-www-form-urlencoded
>> UA-CPU: x86
>> Accept-Encoding: gzip, deflate
>> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
>> 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
>> 3.0.04506.648; .NET CLR 3.5.21022)
>> Host: localhost:2001
>> Content-Length: 733
>> Connection: Keep-Alive
>> Cache-Control: no-cache
>> Cookie: menuPos=%260-1%261-1; JSESSIONID=665E5243A08AF2A83D586E9181487F64
>> _flowExecutionKey=_cDB824BB0-C9AA-F9D1-519F-27E8542F8DE9_k82B5EDEF-9F28-712A-FBAE-5D2965221283&anoEconomico=2008&siglaDirecaoServico=&requerente.nif=&requerente.nome=&nomescgp=&ac=&processoPai=@%E2%82%AC
>>
>> The bolded text is the input text wich is: @€. However the € char is
>> encoded
>> using UTF-8 wich is represented by the %E2%82%AC string.
>>
>> When the request arrives in the Request Processor of Struts this is the
>> value: @€
>>
>> There is probably something that i should configure in Tomcat for this to
>> work.. however i'm completely lost!
>>
>> Can anyone help me please
>>
>> Thanks in advance.
>>
>> Best Regards
>>
>> João Simas
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20193292.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20205114.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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: Tomcat 6 - Problems with encoding
Posted by Leon Rosenberg <ro...@googlemail.com>.
€ sign is not part of ISO-8859-1 use ISO-8859-15 instead.
regards
Leon
On Mon, Oct 27, 2008 at 7:19 PM, JSimas <js...@gmail.com> wrote:
>
> Hi.
>
> I'm using Apache Tomcat 6.0.14, wich deploys a Struts 1.x web application.
>
> I was using encoding ISO-LATIN-1 but i was having problems with the euro (€)
> char. Every time that i use a € char in a text box or in a text area, when
> the request arrives at struts Request Processor the value is already
> deformed.
>
> I've tried to change the encoding into UTF-8 but i also have problems.
>
> Using a HTTP Sniffer, this is what i could gather:
>
> HTTP Post Request into Tomcat:
>
> POST /DRCIEWeb/drcieFlow.do2 HTTP/1.1
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> application/x-shockwave-flash, application/xaml+xml,
> application/vnd.ms-xpsdocument, application/x-ms-xbap,
> application/x-ms-application, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-silverlight, application/x-silverlight-2-b2, */*
> Referer: http://localhost:2001/WebApp/webFlow.do2
> Accept-Language: pt
> Content-Type: application/x-www-form-urlencoded
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
> 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
> 3.0.04506.648; .NET CLR 3.5.21022)
> Host: localhost:2001
> Content-Length: 733
> Connection: Keep-Alive
> Cache-Control: no-cache
> Cookie: menuPos=%260-1%261-1; JSESSIONID=665E5243A08AF2A83D586E9181487F64
> _flowExecutionKey=_cDB824BB0-C9AA-F9D1-519F-27E8542F8DE9_k82B5EDEF-9F28-712A-FBAE-5D2965221283&anoEconomico=2008&siglaDirecaoServico=&requerente.nif=&requerente.nome=&nomescgp=&ac=&processoPai=@%E2%82%AC
>
> The bolded text is the input text wich is: @€. However the € char is encoded
> using UTF-8 wich is represented by the %E2%82%AC string.
>
> When the request arrives in the Request Processor of Struts this is the
> value: @€
>
> There is probably something that i should configure in Tomcat for this to
> work.. however i'm completely lost!
>
> Can anyone help me please
>
> Thanks in advance.
>
> Best Regards
>
> João Simas
>
> --
> View this message in context: http://www.nabble.com/Tomcat-6---Problems-with-encoding-tp20193292p20193292.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Tomcat 6 - Problems with encoding
Posted by Mark Thomas <ma...@apache.org>.
JSimas wrote:
> Hi.
>
> I'm using Apache Tomcat 6.0.14, wich deploys a Struts 1.x web application.
>
> I was using encoding ISO-LATIN-1 but i was having problems with the euro (€)
> char. Every time that i use a € char in a text box or in a text area, when
> the request arrives at struts Request Processor the value is already
> deformed.
>
> I've tried to change the encoding into UTF-8 but i also have problems.
>
> Using a HTTP Sniffer, this is what i could gather:
>
> HTTP Post Request into Tomcat:
>
> POST /DRCIEWeb/drcieFlow.do2 HTTP/1.1
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> application/x-shockwave-flash, application/xaml+xml,
> application/vnd.ms-xpsdocument, application/x-ms-xbap,
> application/x-ms-application, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-silverlight, application/x-silverlight-2-b2, */*
> Referer: http://localhost:2001/WebApp/webFlow.do2
> Accept-Language: pt
> Content-Type: application/x-www-form-urlencoded
> UA-CPU: x86
> Accept-Encoding: gzip, deflate
> User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR
> 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 1.1.4322; InfoPath.2; .NET CLR
> 3.0.04506.648; .NET CLR 3.5.21022)
> Host: localhost:2001
> Content-Length: 733
> Connection: Keep-Alive
> Cache-Control: no-cache
> Cookie: menuPos=%260-1%261-1; JSESSIONID=665E5243A08AF2A83D586E9181487F64
> _flowExecutionKey=_cDB824BB0-C9AA-F9D1-519F-27E8542F8DE9_k82B5EDEF-9F28-712A-FBAE-5D2965221283&anoEconomico=2008&siglaDirecaoServico=&requerente.nif=&requerente.nome=&nomescgp=&ac=&processoPai=@%E2%82%AC
>
> The bolded text is the input text wich is: @€. However the € char is encoded
> using UTF-8 wich is represented by the %E2%82%AC string.
>
> When the request arrives in the Request Processor of Struts this is the
> value: @â¬
>
> There is probably something that i should configure in Tomcat for this to
> work.. however i'm completely lost!
>
> Can anyone help me please
http://wiki.apache.org/tomcat/FAQ/CharacterEncoding
Mark
---------------------------------------------------------------------
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