`
ddandyy
  • 浏览: 211572 次
  • 性别: Icon_minigender_1
  • 来自: 目前上海
社区版块
存档分类
最新评论

字符串转码

 
阅读更多
这个是好久以前留下来的  现在回头一看  实在是.........

	public static String getCharset() {
		return "iso-2022-jp";
	}

	public String iso2gb(String qs) {
		try {
			if (qs == null)
				return "NULL";
			else {
				return new String(qs.getBytes("iso-8859-1"), "gb2312");
			}
		}
		catch (Exception e) {
			System.err.println("iso2gb error・" + e.getMessage());
		}
		return "NULL";
	}

	public String gb2iso(String qs) {
		try {
			if (qs == null)
				return "NULL";
			else {
				return new String(qs.getBytes("gb2312"), "iso-8859-1");
			}
		}
		catch (Exception e) {
			System.err.println("gb2iso error・" + e.getMessage());
		}
		return "NULL";
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics