中文乱码代码
Map<String, String> stringUpload = ((MultipartRequest) request)
.getStringUploads();
if (stringUpload != null && !stringUpload.isEmpty()) {
for (Map.Entry<String, String> entry : stringUpload.entrySet()) {
try {
multipartEntity.addPart(((String) entry.getKey()),
new StringBody((String) entry.getValue()));
} catch (Exception e) {
e.printStackTrace();
}
}
}
修改StringBody,添加utf-8
Map<String, String> stringUpload = ((MultipartRequest) request)
.getStringUploads();
if (stringUpload != null && !stringUpload.isEmpty()) {
for (Map.Entry<String, String> entry : stringUpload.entrySet()) {
try {
multipartEntity.addPart(
((String) entry.getKey()),
new StringBody(entry.getValue(), Charset
.forName("UTF-8")));
} catch (Exception e) {
e.printStackTrace();
}
}
}