这是我的问题.我现在正在使用
Java Apache POI来读取Excel(.xls或.xlsx)文件,并显示内容.电子表格中有一些日语字符,我得到的所有日语字符都是“???”在我的输出中.我尝试使用Shift-JIS,UTF-8和许多其他编码方式,但它不起作用……
这是我的编码代码如下:
public String encoding(String str) throws UnsupportedEncodingException{
String Encoding = "Shift_JIS";
return this.changeCharset(str, Encoding);
}
public String changeCharset(String str, String newCharset) throws UnsupportedEncodingException {
if (str != null) {
byte[] bs = str.getBytes();
return new String(bs, newCharset);
}
return null;
}
我传递了每个字符串(str).但是当我打印返回值时,它仍然像“???” (如下所示)但不是日文字符(平假名,片假名或汉字).
title-jp=???
有人可以帮我这个吗?非常感谢.