1 package cn.itsource._inputsteam; 2 3 import java.io.UnsupportedEncodingException; 4 5 /** 6 * 该类用于编译问题: 7 * 编码转换方法及用法 8 * @author Administrator 9 * 10 */ 11 public class StringTest { 12 13 public static void main(String[] args) throws UnsupportedEncodingException { 14 byte[] b = "动漫男主".getBytes("GBK"); 15 String s = new String(b, 0, b.length, "GBK"); 16 byte[] b1 = s.getBytes("UTF-8"); 17 s = new String(b1, "UTF-8"); 18 System.out.println(s); 19 20 } 21 22 }
标签:11,String,22,GBK,b1,2022,public From: https://www.cnblogs.com/puwei520/p/16916527.html