Skip to content

Commit

Permalink
Better handle non-ASCII characters in settings serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ddwightx committed Jan 15, 2024
1 parent 26c7222 commit 7626414
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonTokenId;
import com.fasterxml.jackson.core.json.JsonWriteFeature;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;
Expand Down Expand Up @@ -89,7 +90,7 @@ public static String serialize(Object value, boolean prettyPrint) {
(prettyPrint ?
objectMapper.writer().withDefaultPrettyPrinter() :
objectMapper.writer()
).writeValue(jsonFactory.createGenerator(stringWriter), value);
).writeValue(jsonFactory.createGenerator(stringWriter).configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, true), value);
return stringWriter.toString();
} catch (IOException e) {
throw new WrappedException(e);
Expand Down

0 comments on commit 7626414

Please sign in to comment.