java學(xué)習(xí)

          java學(xué)習(xí)

           

          中文字符轉(zhuǎn)碼

          1.    String s = “中文”;
          S = new String(s.getBytes(“ISO8859-1”),”utf-9”);
          2.    使用過濾器:
          public class CharsetFilter implements Filter{

              private String encoding = "UTF-8";
              
              public void destroy() {
                  
              }

              public void doFilter(ServletRequest request, ServletResponse response,
                      FilterChain chain) throws IOException, ServletException {
                  request.setCharacterEncoding(encoding);
                  chain.doFilter(request, response);
              }

              public void init(FilterConfig filterConfig) throws ServletException {
                  String encoding = filterConfig.getInitParameter("encoding");
                  if(encoding != null) {
                      this.encoding = encoding;
                  }
              }

          }
          3.request.setCharacterEncoding(“utf-8”);

          posted on 2012-05-04 21:55 楊軍威 閱讀(1936) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 肃南| 孟村| 澄迈县| 乾安县| 横山县| 正定县| 浮梁县| 深圳市| 北安市| 德州市| 平果县| 澳门| 永德县| 宜兴市| 北海市| 洪雅县| 澄城县| 洛隆县| 丰都县| 漯河市| 广饶县| 临漳县| 澜沧| 洛隆县| 安丘市| 澳门| 应用必备| 望都县| 德阳市| 四平市| 郯城县| 游戏| 织金县| 东乌珠穆沁旗| 拜泉县| 衡阳县| 伊通| 准格尔旗| 新干县| 汝阳县| 德钦县|