---
title: "httpclient4 post 请求乱码"
author: "ap0406708"
date: "2016-01-04T20:53:26Z"
tags: []
categories: ["移动开发"]
slug: "httpclient4-post"
draft: false
lastmod: "2016-01-04T20:53:26Z"
id: 2268550
url: "https://ap0406708.iteye.com/blog/2268550"
---

http://my.oschina.net/u/1183927/blog/515969?p=1
1
2
3
4
5
6
HttpPost post=new HttpPost(url);
StringEntity content=new StringEntity(data, Charset.forName("utf-8"));// 第二个参数，设置后才会对，内容进行编码
 
content.setContentType("application/json; charset=UTF-8");
content.setContentEncoding("utf-8");
post.setEntity(content);
