diff --git a/src/main/java/com/sendgrid/Client.java b/src/main/java/com/sendgrid/Client.java index dd82a92..b2086d0 100644 --- a/src/main/java/com/sendgrid/Client.java +++ b/src/main/java/com/sendgrid/Client.java @@ -326,4 +326,4 @@ public Response api(Request request) throws IOException { throw new IOException(errors.toString()); } } -} +} \ No newline at end of file diff --git a/src/main/java/com/sendgrid/SendGridResponseHandler.java b/src/main/java/com/sendgrid/SendGridResponseHandler.java index 95f94f2..66ed893 100644 --- a/src/main/java/com/sendgrid/SendGridResponseHandler.java +++ b/src/main/java/com/sendgrid/SendGridResponseHandler.java @@ -7,6 +7,7 @@ import org.apache.http.client.HttpResponseException; import org.apache.http.impl.client.AbstractResponseHandler; import org.apache.http.util.EntityUtils; +import java.nio.charset.StandardCharsets; /** * A {@link org.apache.http.client.ResponseHandler} that returns the response body as a String @@ -34,9 +35,9 @@ public String handleResponse(final HttpResponse response) return entity == null ? null : handleEntity(entity); } - @Override - public String handleEntity(HttpEntity entity) throws IOException { - return EntityUtils.toString(entity); - } + @Override + public String handleEntity(HttpEntity entity) throws IOException { + return EntityUtils.toString(entity, StandardCharsets.UTF_8); + } }