You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Remy Maucherat <re...@apache.org> on 2003/10/01 18:33:48 UTC

Re: Coyote problems on a EBCDIC machine

jean-frederic clere wrote:

> Hi,
> 
> I have a funny problem with Coyote: The response body are Ok (in ASCII) 
> but the headers are corrupted (probably in EBCDIC). May be somewhere I 
> have to tell Coyote to do ASCII instead default encoding.
> 
> Has someone a hint?

The header writing is in http11.InternalOutputBuffer. Is something 
special needed ?

Remy



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


Re: Coyote problems on a EBCDIC machine

Posted by Remy Maucherat <re...@apache.org>.
jean-frederic clere wrote:

> Remy Maucherat wrote:
> 
>> jean-frederic clere wrote:
>>
>>> Clere, Jean-Frederic wrote:
>>>
>>>> Remy Maucherat wrote:
>>>>
>>>>> jean-frederic clere wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a funny problem with Coyote: The response body are Ok (in 
>>>>>> ASCII) but the headers are corrupted (probably in EBCDIC). May be 
>>>>>> somewhere I have to tell Coyote to do ASCII instead default encoding.
>>>>>>
>>>>>> Has someone a hint?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> The header writing is in http11.InternalOutputBuffer. Is something 
>>>>> special needed ?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Probably some getBytes("ISO-8859-1") instead of getBytes()
>>>
>>>
>>>
>>>
>>> Oops...
>>> Mostly in http11/src/java/org/apache/coyote/http11/Constants.java 
>>> getBytes(char encoding) throws execptions so I have to use:
>>> { (byte) 'a', (byte) 'b' ... };
>>> instead of:
>>> "ab".getBytes();
>>
>>
>>
>> Ah, ok, I wasn't seeing any getBytes in InternalOutputBuffer, so this 
>> was a bit confusing.
> 
> 
> Sorry.
> 
>> Maybe we can add a static method which does the byte by byte copy to 
>> preserve some kind of readability, while still fixing the issue.
> 
> 
> Well that is true that:
> +++
>     public static final byte[] ACK =
>         "HTTP/1.1 100 Continue\r\n\r\n".getBytes();
> +++
> Is more readable than:
> +++
>     public static final byte[] ACK = {
>         (byte) '1',
>         (byte) '.',
>         (byte) '1',
>         (byte) ' ',
>         (byte) '1',
>         (byte) '0',
>         (byte) '0',
>         (byte) ' ',
>         (byte) 'C',
>         (byte) 'o',
>         (byte) 'n',
>         (byte) 't',
>         (byte) 'i',
>         (byte) 'n',
>         (byte) 'u',
>         (byte) 'e',
>         (byte) '\r',
>         (byte) '\n',
>         (byte) '\r',
>         (byte) '\n'
>     };
> +++
> But that is still readable ;-)
> 
> And now my EBCDIC machine seems to return understandable headers :-) 
> (Well it seems now that the body of other things that errors are also 
> somehow in EBCDIC but I will look how to arrange it).
> 
> I will commit the changes in 
> http11/src/java/org/apache/coyote/http11/Constants.java tomorrow if 
> noone complains in the meantime.

Yes, well, I was suggesting adding a static byte[] getBytes() method 
doing the byte by byte conversion (like 
InternalOutputBuffer.write(String) is doing), to get the readability and 
the right conversion.

Remy



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


Re: Coyote problems on a EBCDIC machine

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Remy Maucherat wrote:
> jean-frederic clere wrote:
> 
>> Clere, Jean-Frederic wrote:
>>
>>> Remy Maucherat wrote:
>>>
>>>> jean-frederic clere wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have a funny problem with Coyote: The response body are Ok (in 
>>>>> ASCII) but the headers are corrupted (probably in EBCDIC). May be 
>>>>> somewhere I have to tell Coyote to do ASCII instead default encoding.
>>>>>
>>>>> Has someone a hint?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> The header writing is in http11.InternalOutputBuffer. Is something 
>>>> special needed ?
>>>
>>>
>>>
>>>
>>> Probably some getBytes("ISO-8859-1") instead of getBytes()
>>
>>
>>
>> Oops...
>> Mostly in http11/src/java/org/apache/coyote/http11/Constants.java 
>> getBytes(char encoding) throws execptions so I have to use:
>> { (byte) 'a', (byte) 'b' ... };
>> instead of:
>> "ab".getBytes();
> 
> 
> Ah, ok, I wasn't seeing any getBytes in InternalOutputBuffer, so this 
> was a bit confusing.

Sorry.

> Maybe we can add a static method which does the byte by byte copy to 
> preserve some kind of readability, while still fixing the issue.

Well that is true that:
+++
     public static final byte[] ACK =
         "HTTP/1.1 100 Continue\r\n\r\n".getBytes();
+++
Is more readable than:
+++
     public static final byte[] ACK = {
         (byte) '1',
         (byte) '.',
         (byte) '1',
         (byte) ' ',
         (byte) '1',
         (byte) '0',
         (byte) '0',
         (byte) ' ',
         (byte) 'C',
         (byte) 'o',
         (byte) 'n',
         (byte) 't',
         (byte) 'i',
         (byte) 'n',
         (byte) 'u',
         (byte) 'e',
         (byte) '\r',
         (byte) '\n',
         (byte) '\r',
         (byte) '\n'
     };
+++
But that is still readable ;-)

And now my EBCDIC machine seems to return understandable headers :-) (Well it 
seems now that the body of other things that errors are also somehow in EBCDIC 
but I will look how to arrange it).

I will commit the changes in 
http11/src/java/org/apache/coyote/http11/Constants.java tomorrow if noone 
complains in the meantime.

Cheers

Jean-Frederic
> 
> Remy
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 


Re: Coyote problems on a EBCDIC machine

Posted by Remy Maucherat <re...@apache.org>.
jean-frederic clere wrote:

> Clere, Jean-Frederic wrote:
> 
>> Remy Maucherat wrote:
>>
>>> jean-frederic clere wrote:
>>>
>>>> Hi,
>>>>
>>>> I have a funny problem with Coyote: The response body are Ok (in 
>>>> ASCII) but the headers are corrupted (probably in EBCDIC). May be 
>>>> somewhere I have to tell Coyote to do ASCII instead default encoding.
>>>>
>>>> Has someone a hint?
>>>
>>>
>>>
>>>
>>> The header writing is in http11.InternalOutputBuffer. Is something 
>>> special needed ?
>>
>>
>>
>> Probably some getBytes("ISO-8859-1") instead of getBytes()
> 
> 
> Oops...
> Mostly in http11/src/java/org/apache/coyote/http11/Constants.java 
> getBytes(char encoding) throws execptions so I have to use:
> { (byte) 'a', (byte) 'b' ... };
> instead of:
> "ab".getBytes();

Ah, ok, I wasn't seeing any getBytes in InternalOutputBuffer, so this 
was a bit confusing.
Maybe we can add a static method which does the byte by byte copy to 
preserve some kind of readability, while still fixing the issue.

Remy



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


Re: Coyote problems on a EBCDIC machine

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Clere, Jean-Frederic wrote:
> Remy Maucherat wrote:
> 
>> jean-frederic clere wrote:
>>
>>> Hi,
>>>
>>> I have a funny problem with Coyote: The response body are Ok (in 
>>> ASCII) but the headers are corrupted (probably in EBCDIC). May be 
>>> somewhere I have to tell Coyote to do ASCII instead default encoding.
>>>
>>> Has someone a hint?
>>
>>
>>
>> The header writing is in http11.InternalOutputBuffer. Is something 
>> special needed ?
> 
> 
> Probably some getBytes("ISO-8859-1") instead of getBytes()

Oops...
Mostly in http11/src/java/org/apache/coyote/http11/Constants.java getBytes(char 
encoding) throws execptions so I have to use:
{ (byte) 'a', (byte) 'b' ... };
instead of:
"ab".getBytes();

> 
>>
>> Remy
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



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


Re: Coyote problems on a EBCDIC machine

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Remy Maucherat wrote:
> jean-frederic clere wrote:
> 
>> Hi,
>>
>> I have a funny problem with Coyote: The response body are Ok (in 
>> ASCII) but the headers are corrupted (probably in EBCDIC). May be 
>> somewhere I have to tell Coyote to do ASCII instead default encoding.
>>
>> Has someone a hint?
> 
> 
> The header writing is in http11.InternalOutputBuffer. Is something 
> special needed ?

Probably some getBytes("ISO-8859-1") instead of getBytes()

> 
> Remy
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



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