可能是编码问题,大家帮忙看一下
在[path.properties]文件中,有个下面的对应关系
[path_formatxml=D:/Eclipse32/workspace/ソースTH/資料_xmlFileFormat/]
上面,红色部分的是日文(就是在日文输入法下,输入的)
我利用[Properties]这个类,来读取[path_formatxml]的信息,
Properties prop = new Properties();
FileInputStream fis;
try {
fis = new FileInputStream(propFilePath);
prop.load(fis);
fis.close();
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw e;
}
String path_formatxml = Utils.convertString(prop.getProperty("path_formatxml"));
其中,Utils.convertString()方法:
public static String convertString(String str)
throws UnsupportedEncodingException {
byte[] bytes = str.getBytes("iso-8859-1");
str = new String(bytes, System.getProperty("file.encoding"));
return str;
}
返回的内容是[D:/Eclipse32/workspace/メ[スTH/資料_xmlFileFormat/]
好像是,编码出了问题,我的系统是日文xp,开发环境全是日文的
日文的汉子如[資料]返回正常,但是日文的假名如[ソース]返回不正常
希望,高手,给指点一下哦