You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lixin Chu <li...@gmail.com> on 2005/05/24 09:33:35 UTC
request.getCharacterEncoding always return null ?
Hi,
I always get null from request.getChaaracterEncoding(), do not know why.
I am using Tomcat 5.5.7, Struts 1.1. Tested IE 6.0 and FireFox. Which
ever encoding I select in browser, my servlet always reprots as null
from the above call.
thanks for any info!
li xin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: request.getCharacterEncoding always return null ?
Posted by delbd <de...@oma.be>.
There is a similar problem with encoding defaulting to ISO-8859 what ever the
browser did send as encoding. This is because the servlet container is unable
to interpret the multi-part encoding a solution is to use a constant
enconding in your forms (using the acceptEncoding parameter) and always
assume this is what browser will use. :/
Le Mardi 24 Mai 2005 09:33, Lixin Chu a écrit :
> Hi,
> I always get null from request.getChaaracterEncoding(), do not know why.
>
> I am using Tomcat 5.5.7, Struts 1.1. Tested IE 6.0 and FireFox. Which
> ever encoding I select in browser, my servlet always reprots as null
> from the above call.
>
> thanks for any info!
> li xin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
--
David Delbecq
Royal Meteorological Institute of Belgium
-
Is there life after /sbin/halt -p?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: request.getCharacterEncoding always return null ?
Posted by Lixin Chu <li...@gmail.com>.
I see. thank you all.
it seems that I have to provide a UI to let user select which locale
he wants to use. Is it a common implementation ? I was thinking of
checking character encoding in my application so that I can use the
correct locale.
On 5/24/05, Jason Lea <ja...@kumachan.net.nz> wrote:
> From the java docs:
>
> getCharacterEncoding
>
> public java.lang.String getCharacterEncoding()
>
> Returns the name of the character encoding used in the body of this
> request. This method returns null if the request does not specify a
> character encoding
>
> Returns:
> a String containing the name of the chararacter encoding, or
> null if the request does not specify a character encoding
>
>
> So, the browser might not be sending the character encoding in the
> request. I think browsers won't send the encoding when default encoding
> is used. Some browsers might not send it at all.
>
>
> Lixin Chu wrote:
>
> >Hi,
> >I always get null from request.getChaaracterEncoding(), do not know why.
> >
> >I am using Tomcat 5.5.7, Struts 1.1. Tested IE 6.0 and FireFox. Which
> >ever encoding I select in browser, my servlet always reprots as null
> >from the above call.
> >
> >thanks for any info!
> >li xin
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
> --
> Jason Lea
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: request.getCharacterEncoding always return null ?
Posted by Jason Lea <ja...@kumachan.net.nz>.
From the java docs:
getCharacterEncoding
public java.lang.String getCharacterEncoding()
Returns the name of the character encoding used in the body of this
request. This method returns null if the request does not specify a
character encoding
Returns:
a String containing the name of the chararacter encoding, or
null if the request does not specify a character encoding
So, the browser might not be sending the character encoding in the
request. I think browsers won't send the encoding when default encoding
is used. Some browsers might not send it at all.
Lixin Chu wrote:
>Hi,
>I always get null from request.getChaaracterEncoding(), do not know why.
>
>I am using Tomcat 5.5.7, Struts 1.1. Tested IE 6.0 and FireFox. Which
>ever encoding I select in browser, my servlet always reprots as null
>from the above call.
>
>thanks for any info!
>li xin
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
--
Jason Lea
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org