b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

unicode字符n 提交服务器请求中文字符乱码,需要进行编码转换(2)

电脑杂谈  发布时间:2018-01-12 02:11:49  来源:网络整理

????*/????

??public??String??toUTF_16BE(String??str)??throws??UnsupportedEncodingException{????

????return??this.changeCharset(str,??UTF_16BE);????

??}????

??/**??

????*??将字符编码转换成UTF-16LE码??

unicode字符集_无法转换unicode字符_unicode字符n

????*/????

??public??String??toUTF_16LE(String??str)??throws??UnsupportedEncodingException{????

????return??this.changeCharset(str,??UTF_16LE);????

??}????

??/**??

????*??将字符编码转换成UTF-16码??

????*/????

??public??String??toUTF_16(String??str)??throws??UnsupportedEncodingException{????

????return??this.changeCharset(str,??UTF_16);????

??}????

??/**??

????*??将字符编码转换成GBK码??

????*/????

??public??String??toGBK(String??str)??throws??UnsupportedEncodingException{????

????return??this.changeCharset(str,??GBK);????

??}????

??????

??/**??

????*??字符串编码转换的实现方法??

????*??@param??str????待转换编码的字符串??

????*??@param??newCharset??目标编码??

????*??@return??

????*??@throws??UnsupportedEncodingException??

????*/????

??public??String??changeCharset(String??str,??String??newCharset)????

??????throws??UnsupportedEncodingException??{????

????if??(str??!=??null)??{????

??????//用默认字符编码解码字符串。????

??????byte[]??bs??=??str.getBytes();????

??????//用新的字符编码生成字符串????

??????return??new??String(bs,??newCharset);????

????}????

????return??null;????

??}????

??/**??

????*??字符串编码转换的实现方法??

????*??@param??str????待转换编码的字符串??

????*??@param??oldCharset??原编码??

????*??@param??newCharset??目标编码??

????*??@return??

????*??@throws??UnsupportedEncodingException??

????*/????

??public??String??changeCharset(String??str,??String??oldCharset,??String??newCharset)????


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-59927-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 有天
      有天

      让百姓有了更大选择权

    • 金煜麒
      金煜麒

      看完觉得好尴尬

    • 孙田雨
      孙田雨

      甲午海战北洋水师舰也不少

    每日福利
    热点图片
    拼命载入中...