我用了一个只支持GBK的插件,想把最后执行的串显示成UTF-8形式的怎么办
源码如下:
public static void main(String[] args){
String name=null;
String password=null;
String message = null;
try {
name = new String("是否".getBytes("UTF-8"),"GBK");
password = new String("11111".getBytes("UTF-8"),"GBK");
message = new String("发送短信测试".getBytes("UTF-8"),"GBK");
} catch (Unsupported
EncodingException e1) {
e1.printStackTrace();
}
Sender sms = new Sender(name,password);
String returnCode = sms.massSend("13633618954",message ,"时间","特服代码");
String encode = null;
try{
encode = new String(returnCode.getBytes("GBK"),"UTF-8");
}catch(Exception e){
e.printStackTrace();
}
System.out.println(encode);
}
------解决方案--------------------Java code
encode = new String(returnCode.getBytes("GBK"),"UTF-8");
------解决方案--------------------
要看你的项目是什么编码,............
------解决方案--------------------
简直不知所云,谁跟你说这样可以转的?
所有的字符在 Java 中都是 Unicode,根本不需要你去这样乱转码!
------解决方案--------------------
没明白是要干什么