From 63dbab8fdecf64558a787b156edf4d65e211f5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=BCdeke?= Date: Wed, 15 May 2013 07:46:37 +0200 Subject: [PATCH] Encode Requests with UTF-8 to support German Umlauts in requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if i send have e.g an Recipient like this: new MandrillRecipient("Andreas Lüdeke", "mail@bla.de") mandrill returns a HTTP Status 500 wit message "you must specify a key value". This happens due to the fact that the ü is not properly encoded within the StringEntity. By Specifying the correct Encoding it works properly --- .../clients/mandrill/request/MandrillRESTRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cribbstechnologies/clients/mandrill/request/MandrillRESTRequest.java b/src/main/java/com/cribbstechnologies/clients/mandrill/request/MandrillRESTRequest.java index 5ff8f36..4a5d164 100644 --- a/src/main/java/com/cribbstechnologies/clients/mandrill/request/MandrillRESTRequest.java +++ b/src/main/java/com/cribbstechnologies/clients/mandrill/request/MandrillRESTRequest.java @@ -42,7 +42,7 @@ private BaseMandrillResponse performPostRequest(BaseMandrillRequest request, Str request.setKey(config.getApiKey()); HttpPost postRequest = new HttpPost(config.getServiceUrl() + serviceMethod); String postData = getPostData(request); - StringEntity input = new StringEntity(postData); + StringEntity input = new StringEntity(postData, "UFT-8"); input.setContentType("application/json"); postRequest.setEntity(input);