Re: Default character encoding for ServletRequest

2009-10-08 Thread Halm Reusser

Christopher Schultz wrote:


On that page is a POST form. When I evaluate the posted data, they are NOT
utf-8 encoded.


/Most/ clients will act the way you expect, yet, there is no requirement
for them to do so. What client is this, by the way?


Firefox 3.5.3, IE7, Safari 4.0.3


See the W3C document for the form element, specifically the
accept-charset attribute:
http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset

Read the part about UNKNOWN and how clients MAY interpret this as use
the current page encoding. This is RFC 'MAY' which basically means
it's a recommendation, but not at all required.

If you configure your form like this, the client is essentially required
to use your specified encoding if it expects the server to behave correctly:

form action=... method=POST accept-charset=UTF-8
...
/form

Give that a try and see what happens.


Does neither work. But thanks.

-Halm

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Halm,

On 10/8/2009 3:20 AM, Halm Reusser wrote:
 Christopher Schultz wrote:
 
 Give [accept-charset] a try and see what happens.
 
 Does neither work. But thanks.

:(

Does the client send a Content-Type header including a charset if you
explicitly set it in this way? If not, what character set does it appear
to use when sending data to the server? If you specify UTF-8 but the
client sends ISO-8859-2 or whatever, then you should report a bug
against the client.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrOdaUACgkQ9CaO5/Lv0PA4+ACfRBmZLLR2SrpMVgASluYtIQcW
xHIAnigU6am7IEI3ON6oZiOGJoGSY0IB
=VsEn
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-07 Thread Halm Reusser

Hi Peter,

Peter Crowther wrote:

What are you trying to achieve?  If we know more about the problem you're
trying to solve, we may be able to suggest some different approaches.


The client receives an HTML page with contentType=text/html; charset=utf-8

On that page is a POST form. When I evaluate the posted data, they are NOT
utf-8 encoded.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-07 Thread Halm Reusser

Hi Markus,

thanks for your hints.

Markus Meyer wrote:
It all depends on the client. IIRC if you set the charset in the content 
type header to utf-8, like this


contentType=text/html; charset=utf-8

most browsers will then use utf-8 for HTTP GET and POST requests when 
responding to the given page.


No this doesn't work. Tomcat version 6.0.20, Firefox version 3.5.3, IE 7

-Halm

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-07 Thread Halm Reusser

Hi Andre-John,

Andre-John Mas wrote:

I wan't do it within the application. I prefer to configure the app 
container or the app itself.


I had asked for this too a while back, but I was told the RFC indicates 
ISO-8859-1, so the developers didn't want to allow you to change the 
default encoding used by the application server, which is a shame. I say it

is a shame, because we can already change the URL encoding and being able
to standardise your deployment solutions on UTF-8 would be so much nicer,
IMHO.


Full ack.


My solution was to use a character set filter, described here:

http://wiki.apache.org/tomcat/Tomcat/UTF-8


I did that too, but in my opinion that is no solution, it is just an workaround.

Thanks,
Halm

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-07 Thread Mark Thomas
Halm Reusser wrote:
 Hi Markus,
 
 thanks for your hints.
 
 Markus Meyer wrote:
 It all depends on the client. IIRC if you set the charset in the
 content type header to utf-8, like this

 contentType=text/html; charset=utf-8

 most browsers will then use utf-8 for HTTP GET and POST requests when
 responding to the given page.
 
 No this doesn't work. Tomcat version 6.0.20, Firefox version 3.5.3, IE 7

http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-07 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Halm,

On 10/7/2009 11:44 AM, Halm Reusser wrote:
 Peter Crowther wrote:
 What are you trying to achieve?  If we know more about the problem you're
 trying to solve, we may be able to suggest some different approaches.
 
 The client receives an HTML page with contentType=text/html;
 charset=utf-8
 
 On that page is a POST form. When I evaluate the posted data, they are NOT
 utf-8 encoded.

/Most/ clients will act the way you expect, yet, there is no requirement
for them to do so. What client is this, by the way?

See the W3C document for the form element, specifically the
accept-charset attribute:
http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset

Read the part about UNKNOWN and how clients MAY interpret this as use
the current page encoding. This is RFC 'MAY' which basically means
it's a recommendation, but not at all required.

If you configure your form like this, the client is essentially required
to use your specified encoding if it expects the server to behave correctly:

form action=... method=POST accept-charset=UTF-8
...
/form

Give that a try and see what happens.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrM0zcACgkQ9CaO5/Lv0PC2UQCgsUN9fcJvaLnQ1x1hTGRo8w0s
nskAoJ+vIkGEdWg5+pQuiDp8yMUcw2CW
=x7+0
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Default character encoding for ServletRequest

2009-10-01 Thread Halm Reusser

Hi,

Calling %= request.getCharacterEncoding() % in a jsp deployed in a Tomcat 
6.0.20 container returns null.


Is there any possibility to force a default CharacterEncoding for such requests?

Thanks in advance!

Regards,

--
SWITCH
Serving Swiss Universities
--
Halm Reusser, Software Engineer
Werdstrasse 2, P.O. Box, 8021 Zurich, Switzerland
phone +41 44 268 15 71, fax +41 44 268 15 68
halm.reus...@switch.ch, http://www.switch.ch

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread André Warnier

Halm Reusser wrote:

Hi,

Calling %= request.getCharacterEncoding() % in a jsp deployed in a 
Tomcat 6.0.20 container returns null.


Is there any possibility to force a default CharacterEncoding for such 
requests?



Don't worry, there is already a default.
The only problem is to figure out what it is..
;-)

My guess, at this stage, is that it is either iso-8859-1 (which is the 
default charset for the HTTP protocol), or else it is tied to whatever 
locale your Tomcat's JVM has been started under.
It would also depend on whether the request which you are processing is 
a GET or a POST.
And, whatever you would decide to set as a default at the server level, 
you can still not be quite sure that the client's choice matches yours.


Confused enough ?
Sorry, but that's about the most definite thing that can be said on the 
subject, considering the various often conflicting specifications that 
play a role here.


If the past is any guide however, this post will probably trigger a 
lively discussion.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread Pid

On 01/10/2009 10:44, Halm Reusser wrote:

Hi,

Calling %= request.getCharacterEncoding() % in a jsp deployed in a
Tomcat 6.0.20 container returns null.

Is there any possibility to force a default CharacterEncoding for such
requests?


How about?

 request.setCharacterEncoding(ENCODING);

Bearing in mind that you're not really changing what the client 
requests, or might expect you to be setting...


p



Thanks in advance!

Regards,




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread Halm Reusser

Pid wrote:

How about?

 request.setCharacterEncoding(ENCODING);


I wan't do it within the application. I prefer to configure the app container 
or the app itself.


Bearing in mind that you're not really changing what the client 
requests, or might expect you to be setting...


Is there a possibility to force the client to use a specific encoding?

-Halm

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread Peter Crowther
2009/10/1 Halm Reusser halm.reus...@switch.ch:
 Is there a possibility to force the client to use a specific encoding?

No.  Consider the first request a client makes: it has to create and
send a HTTP request with no prior knowledge of, or communication with,
the server.  So it has no way of asking the server what encoding to
use.

What are you trying to achieve?  If we know more about the problem
you're trying to solve, we may be able to suggest some different
approaches.

- Peter

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread Markus Meyer
It all depends on the client. IIRC if you set the charset in the content 
type header to utf-8, like this


contentType=text/html; charset=utf-8

most browsers will then use utf-8 for HTTP GET and POST requests when 
responding to the given page.


See this thread for some more information:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200111.mbox/%3cd913221a882fd31198d90008c75d6909058b4...@cwnl-ams-pri01.nl.compuware.com%3e#archives

Markus


Halm Reusser schrieb am 01.10.2009 13:22:

Pid wrote:

How about?

 request.setCharacterEncoding(ENCODING);


I wan't do it within the application. I prefer to configure the app 
container or the app itself.


Bearing in mind that you're not really changing what the client 
requests, or might expect you to be setting...


Is there a possibility to force the client to use a specific encoding?

-Halm

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Default character encoding for ServletRequest

2009-10-01 Thread Andre-John Mas


On 1-Oct-2009, at 07:22, Halm Reusser wrote:


Pid wrote:

How about?
request.setCharacterEncoding(ENCODING);


I wan't do it within the application. I prefer to configure the app  
container or the app itself.


I had asked for this too a while back, but I was told the RFC  
indicates ISO-8859-1, so the developers didn't want to allow you to  
change the default encoding used by the application server, which is a  
shame. I say it is a shame, because we can already change the URL  
encoding and being able to standardise your deployment solutions on  
UTF-8 would be so much nicer, IMHO.


My solution was to use a character set filter, described here:

http://wiki.apache.org/tomcat/Tomcat/UTF-8

since the URL wasn't working at the time of posting, also described  
here:


http://tompson.wordpress.com/2007/01/29/encoding-filter-for-java-web-applications/

Bearing in mind that you're not really changing what the client  
requests, or might expect you to be setting...


Is there a possibility to force the client to use a specific encoding?



Generally what ever the client has been asked to display the page in,  
will be used for the next request. At least that is what experience  
has shown me.


André-John
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org