2013-07-01 75 views

回答

1

是否有可能改變返回的默認字符集com.android.volley.toolbox.HttpHeaderParser和那裏的方法parseCharset可以幫助你?

喜歡的東西

/** 
    * Returns the charset specified in the Content-Type of this header, or the 
    * UTF-8 if none can be found. 
    */ 
    public static String parseCharset(Map<String, String> headers) { 
     String contentType = headers.get(HTTP.CONTENT_TYPE); 
     if (contentType != null) { 
      String[] params = contentType.split(";"); 
      for (int i = 1; i < params.length; i++) { 
       String[] pair = params[i].trim().split("="); 
       if (pair.length == 2) { 
        if (pair[0].equals("charset")) { 
         return pair[1]; 
        } 
       } 
      } 
     } 
     return HTTP.UTF_8; 
    }