Browse files

encode POST and PUT bodies in UTF-8 (closes #120)

  • Loading branch information...
1 parent 279971c commit 53f99c1da2578fde0cd6223ae39ee7bdb0a13987 Robert Newson committed May 28, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/com/github/rnewson/couchdb/lucene/couchdb/
@@ -48,15 +48,15 @@ public static final String get(final HttpClient httpClient, final String url) th
public static final String post(final HttpClient httpClient, final String url, final JSONObject body) throws IOException {
final HttpPost post = new HttpPost(url);
post.setHeader("Content-Type", "application/json");
- post.setEntity(new StringEntity(body.toString()));
+ post.setEntity(new StringEntity(body.toString(), "UTF-8"));
return execute(httpClient, post);
public static final int put(final HttpClient httpClient, final String url, final String body) throws IOException {
final HttpPut put = new HttpPut(url);
if (body != null) {
put.setHeader("Content-Type", Constants.CONTENT_TYPE);
- put.setEntity(new StringEntity(body));
+ put.setEntity(new StringEntity(body, "UTF-8"));
return httpClient.execute(put, new StatusCodeResponseHandler());

0 comments on commit 53f99c1

Please sign in to comment.