Skip to content

Commit

Permalink
Merge pull request #7 from kikutaro/issue6
Browse files Browse the repository at this point in the history
Fix Response Charset to UTF-8.
  • Loading branch information
thinkingserious authored Aug 9, 2016
2 parents 728dbf9 + 753400d commit 7e99ce6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/sendgrid/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,4 @@ public Response api(Request request) throws IOException {
throw new IOException(errors.toString());
}
}
}
}
9 changes: 5 additions & 4 deletions src/main/java/com/sendgrid/SendGridResponseHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

}

0 comments on commit 7e99ce6

Please sign in to comment.