You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2008/03/08 08:29:46 UTC

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

     [ https://issues.apache.org/jira/browse/CODEC-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed CODEC-20.
------------------------------

    Resolution: Won't Fix

> [codec] URLCodec.decode() corrupts characters > 127 in unencoded strings
> ------------------------------------------------------------------------
>
>                 Key: CODEC-20
>                 URL: https://issues.apache.org/jira/browse/CODEC-20
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects 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.
-
You can reply to this email to add a comment to the issue online.