- 论坛徽章:
- 0
|
FTP客户端中如何显示中文?
以下的代码给你一个参考。
- /** 说明: ISO_8559_1字符转换为GBK字符
- * @param 需要转换的字符
- * @return 转换后的GBK字符
- */
- public static String IsoToGBK(String strIn)
- {
- String strOut = null;
- if(strIn == null) return "";
- try
- {
- byte[] b = strIn.getBytes("ISO8859_1");
- strOut = new String(b,"GBK");
- }
- catch(UnsupportedEncodingException e)
- {}
- return strOut;
- }
- /** 说明: GBK字符转换为ISO_8559_1字符
- * @param 需要转换的GBK字符
- * @return 转换后的ISO_8559_1字符
- */
- public static String GBKToIso(String strIn)
- {
- byte[] b;
- String strOut = null;
- if(strIn == null) return "";
- try
- {
- b = strIn.getBytes("GBK");
- strOut = new String(b,"ISO8859_1");
- }
- catch(UnsupportedEncodingException e)
- {}
- return strOut;
- }
复制代码 |
|