Fix GsonDeserializer to support unicode characters independently of "file.encoding" system property's value being used by JVM (#592)

Co-authored-by: Oleh Kuzych <oleh_kuzych_tp@bmc.com>
This commit is contained in:
Oleg Kuzych 2020-06-08 21:00:17 +03:00 committed by GitHub
parent 43de9a34e3
commit d8c313cfa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -19,6 +19,8 @@ import com.google.gson.Gson;
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> {
@ -54,6 +56,6 @@ public class GsonDeserializer<T> implements Deserializer<T> {
}
protected T readValue(byte[] bytes) throws IOException {
return gson.fromJson(new String(bytes), returnType);
return gson.fromJson(new String(bytes, Strings.UTF_8), returnType);
}
}