You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Venugopal (JIRA)" <ji...@apache.org> on 2016/07/12 13:02:20 UTC

[jira] [Comment Edited] (VYSPER-334) Plain.java doesn't decode correctly, error appears in multi-byte character;

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

Venugopal edited comment on VYSPER-334 at 7/12/16 1:02 PM:
-----------------------------------------------------------

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);

Attached the screenshot of output printed

Please help.



was (Author: gopubros@gmail.com):
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
>
>         Attachments: screenshot-1.png
>
>
> 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)