接口测试的时候,发现接口返回内容是uncodie类型但是包含中文.在使用print进行打印时输出提示错误: UnicodeEncodeError: 'ascii' codec can't encode characters in position 733-738: ordinal not in range(128) 查阅资料发现是由于内容中包含了中文字符,导致unix系统在print解析是无法正常解析导致. 源码如下: def _ejson(con): comm = "echo '%s' | p…
String iso8859 = new String(sb.toString().getBytes("iso8859-1"));String gbk = new String(sb.toString().getBytes("gbk"));String utf8 = new String(sb.toString().getBytes("utf-8"));if(iso8859.equals(sb.toString())){ System.out.p…