我項目設置的GBK編碼,打印byte3 utf_8時,報錯了?有伙伴了解嗎?
byte[] bytes3=s.getBytes("utf_8");//項目默認gbk編碼
//utf_8編碼中文占用3個字節,英文占用1個字節
for(byte b:bytes3) {
System.out.print(Integer.toHexString(b & 0xff)+" ");
}
報錯:
?java.io.UnsupportedEncodingException: utf_8
byte[] bytes3=s.getBytes("utf_8");//項目默認gbk編碼
//utf_8編碼中文占用3個字節,英文占用1個字節
for(byte b:bytes3) {
System.out.print(Integer.toHexString(b & 0xff)+" ");
}
報錯:
?java.io.UnsupportedEncodingException: utf_8
2019-07-15
舉報
2019-07-16
utf-8吧?