File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
library/src/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,17 @@ public class AsyncHttpResponseHandler {
74
74
protected static final int FINISH_MESSAGE = 3 ;
75
75
76
76
private Handler handler ;
77
+ private String responseCharset = "UTF-8" ;
78
+
79
+ /**
80
+ * Sets the charset for the response string. If not set, the default is UTF-8.
81
+ * @see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Charset</a>
82
+ *
83
+ * @param charset to be used for the response string.
84
+ */
85
+ public void setCharset (final String charset ) {
86
+ this .responseCharset = charset ;
87
+ }
77
88
78
89
/**
79
90
* Creates a new AsyncHttpResponseHandler
@@ -249,7 +260,7 @@ protected void sendResponseMessage(HttpResponse response) {
249
260
HttpEntity temp = response .getEntity ();
250
261
if (temp != null ) {
251
262
entity = new BufferedHttpEntity (temp );
252
- responseBody = EntityUtils .toString (entity , "UTF-8" );
263
+ responseBody = EntityUtils .toString (entity , responseCharset );
253
264
}
254
265
} catch (IOException e ) {
255
266
sendFailureMessage (e , (String ) null );
You can’t perform that action at this time.
0 commit comments