Skip to content

Commit 6b63346

Browse files
committed
Fix for AsyncHttpClient#52 AsyncHttpProviderUtils.contentToString corrupts strings with multibyte encoding (like utf-8)
1 parent 2e3ea67 commit 6b63346

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/java/com/ning/http/util/AsyncHttpProviderUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,7 @@ public final static String getAuthority(URI uri) {
182182
}
183183

184184
public final static String contentToString(Collection<HttpResponseBodyPart> bodyParts, String charset) throws UnsupportedEncodingException {
185-
StringBuilder b = new StringBuilder();
186-
for (HttpResponseBodyPart bp : bodyParts) {
187-
b.append(new String(bp.getBodyPartBytes(), charset));
188-
}
189-
return b.toString();
185+
return new String(contentToByte(bodyParts), charset);
190186
}
191187

192188
public final static byte[] contentToByte(Collection<HttpResponseBodyPart> bodyParts) throws UnsupportedEncodingException {

0 commit comments

Comments
 (0)