aroky1983
发贴: 20
积分: 0
|
于 2007-07-05 13:57
我已经转成功了,因为我需要转码成ASCII,才能在<fmt:setBundle>中正确显示出来,但现在的问题是日文就出问题了。取出来是乱码。 如下: public static String changeToAscIICode(String str) { String temp; StringBuffer bufStr = new StringBuffer(1000); char c; int i, j; bufStr.setLength(0); for (i = 0; i < str.length(); i++) { c = str.charAt; if (c > 255) { bufStr.append("\\u"); j = (c >>> 8); temp = Integer.toHexString(j); if (temp.length() == 1) { bufStr.append("0"); } bufStr.append(temp); j = (c & 0xFF); temp = Integer.toHexString(j); if (temp.length() == 1) { bufStr.append("0"); } bufStr.append(temp); } else { bufStr.append; } } return (new String(bufStr)); }
|