Skip to content

Commit 7138c83

Browse files
authored
Merge pull request jooby-project#2561 from lukasbarti/fix-gson-encoding
Fix GsonModule to also use UTF-8 encoding while decoding
2 parents 6bd0bab + 56b94c3 commit 7138c83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/jooby-gson/src/main/java/io/jooby/json/GsonModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public GsonModule() {
9999
throws Exception {
100100
Body body = ctx.body();
101101
if (body.isInMemory()) {
102-
return gson.fromJson(new InputStreamReader(new ByteArrayInputStream(body.bytes())), type);
102+
return gson.fromJson(new InputStreamReader(new ByteArrayInputStream(body.bytes()), UTF_8), type);
103103
} else {
104104
try (InputStream stream = body.stream()) {
105-
return gson.fromJson(new InputStreamReader(stream), type);
105+
return gson.fromJson(new InputStreamReader(stream, UTF_8), type);
106106
}
107107
}
108108
}

0 commit comments

Comments
 (0)