Skip to content

Commit

Permalink
Fix GsonDeserializer to support unicode characters independently of "…
Browse files Browse the repository at this point in the history
…file.encoding" system property's value being used by JVM
  • Loading branch information
Oleh Kuzych committed May 15, 2020
1 parent 403e189 commit 690c812
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import io.jsonwebtoken.io.DeserializationException;
import io.jsonwebtoken.io.Deserializer;
import io.jsonwebtoken.lang.Assert;
import io.jsonwebtoken.lang.Strings;

import java.io.IOException;

public class GsonDeserializer<T> implements Deserializer<T> {
Expand Down Expand Up @@ -54,6 +56,6 @@ public T deserialize(byte[] bytes) throws DeserializationException {
}

protected T readValue(byte[] bytes) throws IOException {
return gson.fromJson(new String(bytes), returnType);
return gson.fromJson(new String(bytes, Strings.UTF_8), returnType);
}
}

0 comments on commit 690c812

Please sign in to comment.