You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rajat Gupta05 <Ra...@infosys.com> on 2009/03/18 09:23:30 UTC

Issue in sending Request/response http headers containing Japanese charateres

Hi All,

I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.

Any help would be really appreciated.

Thanks
Rajat


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 3/18/2009 11:09 AM, Mark Thomas wrote:
> Go for it. Maybe as a new question along the lines of "Why does it have to be
> like this?"

Done. Now all the research I often re-do when someone asks this question
is collected in one place. I can now answer such questions with a
one-liner. And isn't that what life is really about?

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

iEYEARECAAYFAknBLlwACgkQ9CaO5/Lv0PBSlACfXXQVYKac5E7se4UlFy6EHA9I
2SwAnjYnhVHoZTM/PN2vMKKfEZvwnina
=JNVl
-----END PGP SIGNATURE-----

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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Mark Thomas <ma...@apache.org>.
Christopher Schultz wrote:
> Mark,
> 
> On 3/18/2009 8:57 AM, Mark Thomas wrote:
>> Rajat Gupta05 wrote:
>>> Hi All,
>>>
>>> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
>>> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
>>> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
>>>
>>> Any help would be really appreciated.
>> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4
> 
> I would like to update this wiki page with references to the sections of
> the servlet specification, etc. that lay down these requirements. Would
> that be acceptable? I wouldn't want to update the wiki, only to have
> someone take it out for fear of cluttering the text.

Go for it. Maybe as a new question along the lines of "Why does it have to be
like this?"

Mark

> 
> -chris

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



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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 3/18/2009 8:57 AM, Mark Thomas wrote:
> Rajat Gupta05 wrote:
>> Hi All,
>>
>> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
>> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
>> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
>>
>> Any help would be really appreciated.
> 
> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4

I would like to update this wiki page with references to the sections of
the servlet specification, etc. that lay down these requirements. Would
that be acceptable? I wouldn't want to update the wiki, only to have
someone take it out for fear of cluttering the text.

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

iEYEARECAAYFAknBDgYACgkQ9CaO5/Lv0PAG5gCePVaIB2lVHoX4zvynkAfObllE
pGYAnAx9QTZGsB7kFuVVsvJt7+SdubT8
=TGly
-----END PGP SIGNATURE-----

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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

As Chuck points out, I really meant to encode using UTF-8. The result is
always an US-ASCII string, as per the java.net.URLEncode documentation
(really the URL Spec).

On 3/18/2009 6:51 PM, André Warnier wrote:
> If the string contained any Japanese characters, what would happen is :
> - the string would first be converted to ASCII.  Since ASCII does not
> support Japanese characters, you would get a string with plenty of "???"
> characters (unless java.net.URLEncoder triggers an exception for that).
> - then this string would be URL-encoded, converting the embedded "???"
> into their percent-encoded representation.
> ...and there is thus no chance at all that the server would ever be able
> to retrieve the original Japanese characters.

Right. Since I had this backward, what should really happen is:

UTF-8 is used to encode the Japanese characters into a series of bytes
which are then %-escaped and sent as a valid US-ASCII string.

> Then, the server application would presumably obtain the content of this
> header via a request.getHeader("X-header-name"), and receive a Unicode
> string containing "foobar%45%67%65%43%45%45%78%69...".
> It would then decode it using java.net.URLEncoder.decode(text, "UTF-8"),
> in order to obtain back the original string.
> And it would work fine.

Exactly. Hopefully, the OP will read the entire thread instead of just
taking my bad advice :)

> But in a totally non-portable way (meaning just between that client and
> that application), and with just too many conditional tenses to make
> this comfortable.

Agreed. This is why I recommended using HTTP POST for such data (I know,
I know... don't get you started on POST!).

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

iEYEARECAAYFAknCYfgACgkQ9CaO5/Lv0PBh7wCeI0GcB2TWE5174j3pT1sFX2gF
1BMAnA7fqXRXceapcUQQ+IQfk9oaDwl2
=4ByH
-----END PGP SIGNATURE-----

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


RE: Issue in sending Request/response http headers containing Japanesecharateres

Posted by Rajat Gupta05 <Ra...@infosys.com>.
Thanks everyone for there comments.



I was actually comparing the behavior between IIS and Apache, since IIS(5/6) is able to handle Japanese characters inside the headervalues not the header name.



Thanks

Rajat



-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Thursday, March 19, 2009 6:56 AM
To: Tomcat Users List
Subject: RE: Issue in sending Request/response http headers containing Japanesecharateres



> From: André Warnier [mailto:aw@ice-sa.com]

> Subject: Re: Issue in sending Request/response http headers

> containing Japanesecharateres

>

> > java.net.URLEncoder.encode(text, "ASCII")

> > You'll get a string like

> > "foobar%45%67%65%43%45%45%78%69...".

>

> Yes, but in my humble opinion you would be, as they say,

> "cruising for a bruise".



That's "cruisin' for a bruisin'", to be precise.



I think Chris meant:

    java.net.URLEncoder.encode(text, "UTF-8")

which is what W3C recommends.



 - Chuck





THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.



---------------------------------------------------------------------

To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

For additional commands, e-mail: users-help@tomcat.apache.org



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Issue in sending Request/response http headers containing Japanesecharateres

Posted by André Warnier <aw...@ice-sa.com>.
And as we recently mentioned the incompleteness of the current HTTP 
specification - at least in matters charsets - it may be worth 
remembering that it was 20 years ago, in March 1989, that a then 
little-known computer guy at CERN named Tim Berners-Lee wrote the paper 
"Information Management: A proposal", which invented HTTP and hence the WWW.
And it took still a while after that for Unicode and UTF-8 to settle, so 
we can hardly blame him for having bypassed that aspect.
So hats off, and a respectful minute of appreciation.
If he hadn't, what would we all be busy with right now ?

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


RE: Issue in sending Request/response http headers containing Japanesecharateres

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: Issue in sending Request/response http headers 
> containing Japanesecharateres
> 
> > java.net.URLEncoder.encode(text, "ASCII")
> > You'll get a string like 
> > "foobar%45%67%65%43%45%45%78%69...".
>
> Yes, but in my humble opinion you would be, as they say, 
> "cruising for a bruise".

That's "cruisin' for a bruisin'", to be precise.

I think Chris meant:
    java.net.URLEncoder.encode(text, "UTF-8")
which is what W3C recommends.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by André Warnier <aw...@ice-sa.com>.
Chris,

Christopher Schultz wrote:
[...]

  there's a somewhat obvious way to encode your
> headers (including Japanese or other non-ASCII characters) so they will
> work:
> 
> java.net.URLEncoder.encode(text, "ASCII")
> 
> You'll get a string like "foobar%45%67%65%43%45%45%78%69...". You just
> have to remember to decode the string on the other end in a similar way
> (java.net.URLDecoder).
> 
Yes, but in my humble opinion you would be, as they say, "cruising for a 
bruise".  Your very example above demonstrates the bruise potential.

If the string contained any Japanese characters, what would happen is :
- the string would first be converted to ASCII.  Since ASCII does not 
support Japanese characters, you would get a string with plenty of "???" 
characters (unless java.net.URLEncoder triggers an exception for that).
- then this string would be URL-encoded, converting the embedded "???" 
into their percent-encoded representation.
...and there is thus no chance at all that the server would ever be able 
to retrieve the original Japanese characters.

So let's say that we rectify your undoubtedly slip of the keyboard 
mistake above, and replace this by :
java.net.URLEncoder.encode(text, "UTF-8")

And let's say that the client and server have somehow (?) agreed on this 
in advance, and also agreed that they will do this only in headers 
clearly marked as non-standard (á la X-header-name:), and agreed in 
advance in which headers, and agreed in advance that they will both use 
the same encoding.
Then, the server application would presumably obtain the content of this 
header via a request.getHeader("X-header-name"), and receive a Unicode 
string containing "foobar%45%67%65%43%45%45%78%69...".
It would then decode it using java.net.URLEncoder.decode(text, "UTF-8"), 
in order to obtain back the original string.
And it would work fine.

But in a totally non-portable way (meaning just between that client and 
that application), and with just too many conditional tenses to make 
this comfortable.

Once again, I think what we are bumping against is a shortcoming of the 
HTTP protocol, but until such a time as the powers-that-be at that level 
decide to publish another revision, I think it is safer to stick to the 
one we've got.



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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 3/18/2009 11:15 AM, André Warnier wrote:
> So, with Japanese characters in HTTP headers, you are outside of the
> HTTP specification, and you cannot expect any webserver (or proxy) to
> handle this in any consistent manner.
> 
> HTTP headers can specify the type and character set of the HTTP message
> /body/, but there exists to my knowledge no mechanism to specify the
> character set of a HTTP header.

While this is correct, there's a somewhat obvious way to encode your
headers (including Japanese or other non-ASCII characters) so they will
work:

java.net.URLEncoder.encode(text, "ASCII")

You'll get a string like "foobar%45%67%65%43%45%45%78%69...". You just
have to remember to decode the string on the other end in a similar way
(java.net.URLDecoder).

That should do it, though I would recommend using a POST body with a
properly-set Content-Type (including encoding!) for sending data that
isn't going to be ASCII-only.

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

iEYEARECAAYFAknBHb0ACgkQ9CaO5/Lv0PD10ACgjfpjy2S8iXmTyKLQaWowKTAH
eAcAn2ieCHyhRYMztzkYlPMuqoSxahnG
=cjuG
-----END PGP SIGNATURE-----

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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by André Warnier <aw...@ice-sa.com>.
Rajat Gupta05 wrote:
> In that case response is "??????????????user1"

Rajat,
you are talking about HTTP headers, so below is relevant if you are 
using the correct words and refer effectively to HTTP headers.

I think what Mark was tying to tell you before is :

The current HTTP specification does not allow for HTTP header values to 
be encoded in anything else than ASCII or, at the limit, ISO-8859-1.
The HTTP official specification, RFC2616, talks of "octets" for the 
value of a header (which theoretically would be any combination of 8-bit 
bytes), but also refers to another RFC, much older, RFC822.
And that one says :
3.1.2.  STRUCTURE OF HEADER FIELDS

         Once a field has been unfolded, it may be viewed as being com-
         posed of a field-name followed by a colon (":"), followed by a
         field-body, and  terminated  by  a  carriage-return/line-feed.
         The  field-name must be composed of printable ASCII characters
         (i.e., characters that  have  values  between  33.  and  126.,
         decimal, except colon).  The field-body may be composed of any
         ASCII characters, except CR or LF.  (While CR and/or LF may be
         present  in the actual text, they are removed by the action of
         unfolding the field.)

So, with Japanese characters in HTTP headers, you are outside of the 
HTTP specification, and you cannot expect any webserver (or proxy) to 
handle this in any consistent manner.

HTTP headers can specify the type and character set of the HTTP message 
/body/, but there exists to my knowledge no mechanism to specify the 
character set of a HTTP header.

However, if you are talking about the HTTP request line (the URL), and 
not about HTTP headers, then please restate your question correctly.




> 
> Thanks
> Rajat
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Wednesday, March 18, 2009 7:07 PM
> To: Tomcat Users List
> Subject: Re: Issue in sending Request/response http headers containing Japanese charateres
> 
> Rajat Gupta05 wrote:
>> Hey Mark,
>>
>> Thanks for your response... I have tried to isolate the issue if it is being caused by Apache/Mod_jk/Tomcat. Firstly I tried a request to standlone apache with customize d header having Japanese characters. The requested page displays the headers in the request. To my surprise Apache is not dealing with Japanese characters correctly and replacing them with some junk value. For example I addedミが完たソ税一使饅漢社氏ソ圧user1 in the request header and wht I received was ~‚ªŠ®‚½ƒ\ÅˆêŽgé\Š¿ŽÐŽ¿ˆ³user1.
>>
>> Also to add the same thing works when make request to apache configured to reverse proxy. Can any one provide explanation to that?
> 
> RFC2616. You have to use ISO-8859-1.
> 
> Mark
> 
>> Thanks
>> Rajat
>>
>> -----Original Message-----
>> From: Mark Thomas [mailto:markt@apache.org] 
>> Sent: Wednesday, March 18, 2009 6:27 PM
>> To: Tomcat Users List
>> Subject: Re: Issue in sending Request/response http headers containing Japanese charateres
>>
>> Rajat Gupta05 wrote:
>>> Hi All,
>>>
>>> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
>>> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
>>> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
>>>
>>> Any help would be really appreciated.
>> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4
>>
>> Mark
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>> **************** CAUTION - Disclaimer *****************
>> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
>> for the use of the addressee(s). If you are not the intended recipient, please 
>> notify the sender by e-mail and delete the original message. Further, you are not 
>> to copy, disclose, or distribute this e-mail or its contents to any other person and 
>> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
>> every reasonable precaution to minimize this risk, but is not liable for any damage 
>> you may sustain as a result of any virus in this e-mail. You should carry out your 
>> own virus checks before opening the e-mail or attachment. Infosys reserves the 
>> right to monitor and review the content of all messages sent to or from this e-mail 
>> address. Messages sent to or from this e-mail address may be stored on the 
>> Infosys e-mail system.
>> ***INFOSYS******** End of Disclaimer ********INFOSYS***
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


RE: Issue in sending Request/response http headers containing Japanese charateres

Posted by Rajat Gupta05 <Ra...@infosys.com>.
In that case response is "??????????????user1"

Thanks
Rajat

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Wednesday, March 18, 2009 7:07 PM
To: Tomcat Users List
Subject: Re: Issue in sending Request/response http headers containing Japanese charateres

Rajat Gupta05 wrote:
> Hey Mark,
> 
> Thanks for your response... I have tried to isolate the issue if it is being caused by Apache/Mod_jk/Tomcat. Firstly I tried a request to standlone apache with customize d header having Japanese characters. The requested page displays the headers in the request. To my surprise Apache is not dealing with Japanese characters correctly and replacing them with some junk value. For example I addedミが完たソ税一使饅漢社氏ソ圧user1 in the request header and wht I received was ~‚ªŠ®‚½ƒ\ÅˆêŽgé\Š¿ŽÐŽ¿ˆ³user1.
> 
> Also to add the same thing works when make request to apache configured to reverse proxy. Can any one provide explanation to that?

RFC2616. You have to use ISO-8859-1.

Mark

> 
> Thanks
> Rajat
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Wednesday, March 18, 2009 6:27 PM
> To: Tomcat Users List
> Subject: Re: Issue in sending Request/response http headers containing Japanese charateres
> 
> Rajat Gupta05 wrote:
>> Hi All,
>>
>> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
>> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
>> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
>>
>> Any help would be really appreciated.
> 
> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
> for the use of the addressee(s). If you are not the intended recipient, please 
> notify the sender by e-mail and delete the original message. Further, you are not 
> to copy, disclose, or distribute this e-mail or its contents to any other person and 
> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
> every reasonable precaution to minimize this risk, but is not liable for any damage 
> you may sustain as a result of any virus in this e-mail. You should carry out your 
> own virus checks before opening the e-mail or attachment. Infosys reserves the 
> right to monitor and review the content of all messages sent to or from this e-mail 
> address. Messages sent to or from this e-mail address may be stored on the 
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***


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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 3/18/2009 9:36 AM, Mark Thomas wrote:
> RFC2616. You have to use ISO-8859-1.

It's worse than that: it's ASCII, not ISO-8859-1.

HTTP headers are actually delegated (in section 4.2) to RFC822
("Internet Text Messages").

HTTP section 4.2
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
"
HTTP header fields, which include general-header (section 4.5),
request-header (section 5.3), response-header (section 6.2), and
entity-header (section 7.1) fields, follow the same generic format as
that given in Section 3.1 of RFC 822 [9]
"

RFC822 Section 3.1 (http://www.w3.org/Protocols/rfc822/)

"
The body is simply a sequence of lines containing ASCII characters.
"

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

iEYEARECAAYFAknBDDwACgkQ9CaO5/Lv0PCeiwCfeVwKCt9FQSl2IauiSvzve8T4
2n8AoKiKnY+p/Mdyuc//lJTKwjt73Kf/
=YC/M
-----END PGP SIGNATURE-----

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


Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Mark Thomas <ma...@apache.org>.
Rajat Gupta05 wrote:
> Hey Mark,
> 
> Thanks for your response... I have tried to isolate the issue if it is being caused by Apache/Mod_jk/Tomcat. Firstly I tried a request to standlone apache with customize d header having Japanese characters. The requested page displays the headers in the request. To my surprise Apache is not dealing with Japanese characters correctly and replacing them with some junk value. For example I addedミが完たソ税一使饅漢社氏ソ圧user1 in the request header and wht I received was ~‚ªŠ®‚½ƒ\ÅˆêŽgé\Š¿ŽÐŽ¿ˆ³user1.
> 
> Also to add the same thing works when make request to apache configured to reverse proxy. Can any one provide explanation to that?

RFC2616. You have to use ISO-8859-1.

Mark

> 
> Thanks
> Rajat
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org] 
> Sent: Wednesday, March 18, 2009 6:27 PM
> To: Tomcat Users List
> Subject: Re: Issue in sending Request/response http headers containing Japanese charateres
> 
> Rajat Gupta05 wrote:
>> Hi All,
>>
>> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
>> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
>> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
>>
>> Any help would be really appreciated.
> 
> http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q4
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
> for the use of the addressee(s). If you are not the intended recipient, please 
> notify the sender by e-mail and delete the original message. Further, you are not 
> to copy, disclose, or distribute this e-mail or its contents to any other person and 
> any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
> every reasonable precaution to minimize this risk, but is not liable for any damage 
> you may sustain as a result of any virus in this e-mail. You should carry out your 
> own virus checks before opening the e-mail or attachment. Infosys reserves the 
> right to monitor and review the content of all messages sent to or from this e-mail 
> address. Messages sent to or from this e-mail address may be stored on the 
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***


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


RE: Issue in sending Request/response http headers containing Japanese charateres

Posted by Rajat Gupta05 <Ra...@infosys.com>.
Hey Mark,

Thanks for your response... I have tried to isolate the issue if it is being caused by Apache/Mod_jk/Tomcat. Firstly I tried a request to standlone apache with customize d header having Japanese characters. The requested page displays the headers in the request. To my surprise Apache is not dealing with Japanese characters correctly and replacing them with some junk value. For example I addedミが完たソ税一使饅漢社氏ソ圧user1 in the request header and wht I received was ~‚ªŠ®‚½ƒ\ÅˆêŽgé\Š¿ŽÐŽ¿ˆ³user1.

Also to add the same thing works when make request to apache configured to reverse proxy. Can any one provide explanation to that?

Thanks
Rajat

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: Wednesday, March 18, 2009 6:27 PM
To: Tomcat Users List
Subject: Re: Issue in sending Request/response http headers containing Japanese charateres

Rajat Gupta05 wrote:
> Hi All,
> 
> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
> 
> Any help would be really appreciated.

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

Mark

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


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Re: Issue in sending Request/response http headers containing Japanese charateres

Posted by Mark Thomas <ma...@apache.org>.
Rajat Gupta05 wrote:
> Hi All,
> 
> I have a configuration where Apache(2.2) -->Mod_jk-->Tomcat(5.0) for my program.
> Now whenever I receive request or response having httpheaders with Japanese charaters, those are either replaced by ??? or they are replaced by some junk charateres.
> Please see the Japanese headers are encoded with SHIFT_JIS encoding. Is there are a way where we can provide this encoding inside Apcahe/mod_jk/Tomcat.
> 
> Any help would be really appreciated.

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

Mark

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