1秒登錄
定義一字符串:
String t = "hfjkds中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國中國hfsdkj<img src='sasa' /> fjldsajflkdsjaflkdsjalf <img src='sada' ait=''/>sfdsfadas";思路:先轉為Unicode,然后轉為GBK
String utf8 = new String(t.getBytes( "UTF-8")); System.out.println(utf8); String unicode = new String(utf8.getBytes(),"UTF-8"); System.out.println(unicode); String gbk = new String(unicode.getBytes("GBK")); System.out.println(gbk);
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。