我正在尝试使用 base64 显示和更新简体中文(GB2312)字符集,Base64 到 GB2312 工作正常,但我无法将 GB2312 转换为 base64
String str="17DP5Mqxx+vFxNXV";
Base64 base64=new Base64();
String gb2312=new String(base64.decode(str.getBytes()),"GB2312");
System.out.println("GB2312 = "+gb2312);
String baseString=new String(base64.encode(gb2312.getBytes()));
System.out.println("Base64 = "+baseString);
实际结果是
GB2312 = 装箱时请拉客
Base64 =6KOF566x5pe26K+35ouN54Wn
预期结果是
GB2312 = 装箱时请拉客
Base64 = 17DP5Mqxx+vFxNXV