Closed oskarscot closed 2 years ago
My best guess is that the missing encoding in the OutputStreamWriter provided to the Gson#toJson method may cause this in some cases. Please check if the issue persists, whilst using okaeri-configs version 4.0.0-beta4
.
My best guess is that the missing encoding in the OutputStreamWriter provided to the Gson#toJson method may cause this in some cases. Please check if the issue persists, whilst using okaeri-configs version
4.0.0-beta4
.
No, just tested it. The issue is still there
Seems like I missed the second part about the \u0026
. The fix would enforce the correct encoding, but this one is not related.
Gson is just leaning on the safer side with its defaults: https://stackoverflow.com/questions/4147012/can-you-avoid-gson-converting-and-into-unicode-escape-sequences
Fixed in 4.0.0-beta6
by adding #disableHtmlEscaping()
call to the default GsonBuilder sequence. Can be also enforced in the older versions using JsonGsonConfigurer(Gson)
constructor:
new JsonGsonConfigurer(new GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.create())
Describe the bug JsonGsonConfigurer does not encode characters like ó, ę, ś, ą, ń, ć, », &
To Reproduce Steps to reproduce the behavior: Create a normal config using the JsonGsonConfigurer
Expected behavior Characters should be encoded normally instead they're replaced as ? or an escaped java unicode character like \u0026
Library version json gson configs ver 3.4.2
Config classes and setup routine coreConfig = ConfigManager.create(CoreConfig.class, (it) -> it.withConfigurer(new JsonGsonConfigurer()) .withBindFile(new File(this.getDataFolder(), "config.json")) .saveDefaults() .load(true));