Skip to content

Commit 7e99ce6

Browse files
Merge pull request #7 from kikutaro/issue6
Fix Response Charset to UTF-8.
2 parents 728dbf9 + 753400d commit 7e99ce6

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/java/com/sendgrid/Client.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,4 +326,4 @@ public Response api(Request request) throws IOException {
326326
throw new IOException(errors.toString());
327327
}
328328
}
329-
}
329+
}

src/main/java/com/sendgrid/SendGridResponseHandler.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.apache.http.client.HttpResponseException;
88
import org.apache.http.impl.client.AbstractResponseHandler;
99
import org.apache.http.util.EntityUtils;
10+
import java.nio.charset.StandardCharsets;
1011

1112
/**
1213
* 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)
3435
return entity == null ? null : handleEntity(entity);
3536
}
3637

37-
@Override
38-
public String handleEntity(HttpEntity entity) throws IOException {
39-
return EntityUtils.toString(entity);
40-
}
38+
@Override
39+
public String handleEntity(HttpEntity entity) throws IOException {
40+
return EntityUtils.toString(entity, StandardCharsets.UTF_8);
41+
}
4142

4243
}

0 commit comments

Comments
 (0)