Skip to content
Permalink
Browse files
fix: JSON spec mandates UTF-8 (#1220)
  • Loading branch information
elharo committed Jan 12, 2021
1 parent f605679 commit adb2ea41c4eee61174ec6e588dec576fc53169f6
Showing with 2 additions and 4 deletions.
  1. +2 −4 google-http-client-gson/src/main/java/com/google/api/client/json/gson/GsonFactory.java
@@ -18,7 +18,6 @@
import com.google.api.client.json.JsonGenerator;
import com.google.api.client.json.JsonParser;
import com.google.api.client.util.Beta;
import com.google.api.client.util.Charsets;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.InputStream;
@@ -29,6 +28,7 @@
import java.io.StringReader;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
* Low-level JSON library implementation based on GSON.
@@ -60,9 +60,7 @@ static class InstanceHolder {

@Override
public JsonParser createJsonParser(InputStream in) {
// TODO(mlinder): Parser should try to detect the charset automatically when using GSON
// https://github.com/googleapis/google-http-java-client/issues/6
return createJsonParser(new InputStreamReader(in, Charsets.UTF_8));
return createJsonParser(new InputStreamReader(in, StandardCharsets.UTF_8));
}

@Override

0 comments on commit adb2ea4

Please sign in to comment.