|
46 | 46 | import com.google.firebase.remoteconfig.FirebaseRemoteConfigException;
|
47 | 47 | import com.google.firebase.remoteconfig.FirebaseRemoteConfigServerException;
|
48 | 48 | import com.google.firebase.remoteconfig.internal.ConfigFetchHandler.FetchResponse;
|
49 |
| -import java.io.BufferedInputStream; |
50 | 49 | import java.io.BufferedOutputStream;
|
| 50 | +import java.io.BufferedReader; |
51 | 51 | import java.io.IOException;
|
52 |
| -import java.io.InputStream; |
| 52 | +import java.io.InputStreamReader; |
53 | 53 | import java.io.OutputStream;
|
54 | 54 | import java.net.HttpURLConnection;
|
55 | 55 | import java.net.URL;
|
@@ -178,7 +178,7 @@ FetchResponse fetch(
|
178 | 178 | byte[] requestBody =
|
179 | 179 | createFetchRequestBody(instanceId, instanceIdToken, analyticsUserProperties)
|
180 | 180 | .toString()
|
181 |
| - .getBytes(); |
| 181 | + .getBytes("utf-8"); |
182 | 182 | setFetchRequestBody(urlConnection, requestBody);
|
183 | 183 |
|
184 | 184 | urlConnection.connect();
|
@@ -321,10 +321,11 @@ private void setFetchRequestBody(HttpURLConnection urlConnection, byte[] request
|
321 | 321 |
|
322 | 322 | private JSONObject getFetchResponseBody(URLConnection urlConnection)
|
323 | 323 | throws IOException, JSONException {
|
324 |
| - InputStream in = new BufferedInputStream(urlConnection.getInputStream()); |
| 324 | + BufferedReader br = |
| 325 | + new BufferedReader(new InputStreamReader(urlConnection.getInputStream(), "utf-8")); |
325 | 326 | StringBuilder responseStringBuilder = new StringBuilder();
|
326 | 327 | int current = 0;
|
327 |
| - while ((current = in.read()) != -1) { |
| 328 | + while ((current = br.read()) != -1) { |
328 | 329 | responseStringBuilder.append((char) current);
|
329 | 330 | }
|
330 | 331 |
|
|
0 commit comments