晟天帝成神之路
中二病洛晟危
 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 }

 

posted on 2022-11-22 21:27  洛晟  阅读(12)  评论(0)    收藏  举报