日期:2014-05-16 浏览次数:20389 次
private String getDataHeader() { int i = m_currentIndex; int j = 0; for (boolean flag1 = false; !flag1;) if (m_binArray[m_currentIndex] == 13 && m_binArray[m_currentIndex + 2] == 13) { flag1 = true; j = m_currentIndex - 1; m_currentIndex = m_currentIndex + 2; } else { m_currentIndex++; } //修改开始 String s = null; try { //修改代码,首先得到响应的字符编码类型,然后对得到的字符串进行编码。 String encode = m_response.getCharacterEncoding(); if(encode.equalsIgnoreCase("UTF-8")) { s = new String(m_binArray, i, (j - i) + 1, "UTF-8"); } else { s = new String(m_binArray, i, (j - i) + 1); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } //修改结束 return s; }