You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/07/14 07:29:30 UTC

[jira] Updated: (CODEC-20) [codec] URLCodec.decode() corrupts characters > 127 in unencoded strings

     [ http://issues.apache.org/jira/browse/CODEC-20?page=all ]

Henri Yandell updated CODEC-20:
-------------------------------

    Bugzilla Id:   (was: 31161)
    Fix Version: 1.4

Looks like this issue is probably ready for closing with the result being the added unit test to show that Codec can't do much here.

> [codec] URLCodec.decode() corrupts characters > 127 in unencoded strings
> ------------------------------------------------------------------------
>
>          Key: CODEC-20
>          URL: http://issues.apache.org/jira/browse/CODEC-20
>      Project: Commons Codec
>         Type: Bug

>     Versions: 1.3
>  Environment: Operating System: Linux
> Platform: PC
>     Reporter: Hannes Wallnoefer
>      Fix For: 1.4
>  Attachments: codec.patch
>
> If URLCodec.decode() is called with a String that contains unencoded characters
> in the 128-255 range, these characters are corrupted. The reason for this is in
> the way characters that don't need decoding are passed from the source to the
> target string:
>             int b = bytes[i];
>             
>             (...)
>      
>             buffer.write(b);
> If a character code is > 127, it results in integer b being in the -128..-1
> range, and when it's lowest byte is written to the buffer it's something else
> than the original one. 
> I think the fix would be to add 256 to b if b is less than zero.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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