Skip to content

Commit

Permalink
fix: JSON spec mandates UTF-8 (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Jan 12, 2021
1 parent f605679 commit adb2ea4
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit adb2ea4

Please sign in to comment.