americanexpress / nodes

A GraphQL JVM Client - Java, Kotlin, Scala, etc.
Apache License 2.0
307 stars 70 forks source link

Invalid charset during deserialization on JVM with default encoding other than UTF-8 #49

Closed mkalen closed 5 years ago

mkalen commented 6 years ago

io.aexp.nodes.graphql.Fetch uses a Java InputStreamReader without explicit charset. If Nodes is running under a JVM with default encoding other than UTF-8 (i.e. under Windows), the response deserialization will not handle the JSON strings in the UTF-8 server response correctly since the deserialization is based on the stream reader with JVM default charset (!= UTF-8 i.e. different from actual response). Thus any string values with extended characters will contain invalid/mis-encoded values. E.g. "Martin Kalén" will be deserialized as "Martin Kalén".