mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Venugopal (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VYSPER-334) Plain.java doesn't decode correctly, error appears in multi-byte character;
Date Tue, 12 Jul 2016 13:00:23 GMT

    [ https://issues.apache.org/jira/browse/VYSPER-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15372839#comment-15372839
] 

Venugopal commented on VYSPER-334:
----------------------------------

I too facing similar issue.i have commons-codec-1.6.jar in my environment. Below is the code
snippet i used

String label is the Base64 UTF-8 encoded string
byte[] decoded = null;
String utf8String = null;
decoded = Base64.decodeBase64(label.getBytes());
utf8String = new String(decoded);
System.out.println(utf8String);

Please help.


> Plain.java doesn't decode correctly, error appears in multi-byte character;
> ---------------------------------------------------------------------------
>
>                 Key: VYSPER-334
>                 URL: https://issues.apache.org/jira/browse/VYSPER-334
>             Project: VYSPER
>          Issue Type: Bug
>          Components: core protocol
>    Affects Versions: 0.7
>         Environment: window.
>            Reporter: wan jian ming
>            Assignee: Bernd Fondermann
>             Fix For: 0.8
>
>
> decoded = Base64.decodeBase64(base64Encoded.getText().getBytes());
> char ch = (char) decoded[i];
>             if (ch != 0) {
>                 stringBuilder.append(ch);
> in multi-byte character environment,  one char may composed of many bytes,  so it is
not correct here to make one byte to one char.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message