This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch maintenance_1.0.x
in repository https://gitbox.apache.org/repos/asf/johnzon.git
The following commit(s) were added to refs/heads/maintenance_1.0.x by this push:
new 3294227 Use the configured charset instead of always relying on the
default one.
3294227 is described below
commit 32942275ab8ea2edba33f534171b13d96cea6898
Author: Svetlin Zarev <[email protected]>
AuthorDate: Thu Jan 30 09:43:30 2020 +0200
Use the configured charset instead of always relying on the default one.
---
johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
index 0dc8a3c..308f8f3 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
@@ -40,6 +40,7 @@ import java.lang.reflect.Array;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
@@ -177,10 +178,9 @@ public class Mapper implements Closeable {
public void writeObject(final Object object, final OutputStream stream) {
Charset charset = config.getEncoding();
if (charset == null) {
- writeObject(object, new OutputStreamWriter(stream));
- } else {
- writeObject(object, new OutputStreamWriter(stream));
+ charset = StandardCharsets.UTF_8;
}
+ writeObject(object, new OutputStreamWriter(stream, charset));
}
private void writeObject(final Object object, final JsonGenerator
generator, final Collection<String> ignored, JsonPointerTracker jsonPointer) {