This is an automated email from the ASF dual-hosted git repository.

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new d182e55ae [ISSUE #4031] Specifies the default character set (#4057)
d182e55ae is described below

commit d182e55aeaf890eb5df0d0e749ecff681563cd9e
Author: Monty Mole <[email protected]>
AuthorDate: Wed Jun 7 10:47:03 2023 +0800

    [ISSUE #4031] Specifies the default character set (#4057)
---
 .../apache/eventmesh/storage/mongodb/utils/MongodbCloudEventUtil.java  | 3 ++-
 .../org/apache/eventmesh/storage/rabbitmq/utils/ByteArrayUtils.java    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/utils/MongodbCloudEventUtil.java
 
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/utils/MongodbCloudEventUtil.java
index b42626f67..51bb19d06 100644
--- 
a/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/utils/MongodbCloudEventUtil.java
+++ 
b/eventmesh-storage-plugin/eventmesh-storage-mongodb/src/main/java/org/apache/eventmesh/storage/mongodb/utils/MongodbCloudEventUtil.java
@@ -17,6 +17,7 @@
 
 package org.apache.eventmesh.storage.mongodb.utils;
 
+import org.apache.eventmesh.common.Constants;
 import org.apache.eventmesh.storage.mongodb.exception.MongodbStorageException;
 
 import java.net.URI;
@@ -44,7 +45,7 @@ public class MongodbCloudEventUtil {
             default:
                 throw new MongodbStorageException(String.format("CloudEvent 
version %s does not support.", version));
         }
-        builder.withData(document.remove("data").toString().getBytes())
+        
builder.withData(document.remove("data").toString().getBytes(Constants.DEFAULT_CHARSET))
                 .withId(document.remove("id").toString())
                 .withSource(URI.create(document.remove("source").toString()))
                 .withType(document.remove("type").toString())
diff --git 
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/utils/ByteArrayUtils.java
 
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/utils/ByteArrayUtils.java
index b506eca19..a362767ca 100644
--- 
a/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/utils/ByteArrayUtils.java
+++ 
b/eventmesh-storage-plugin/eventmesh-storage-rabbitmq/src/main/java/org/apache/eventmesh/storage/rabbitmq/utils/ByteArrayUtils.java
@@ -30,7 +30,7 @@ public class ByteArrayUtils {
 
     public static <T> Optional<byte[]> objectToBytes(T obj) throws IOException 
{
         String s = JsonUtils.toJSONString(obj);
-        byte[] bytes = s.getBytes();
+        byte[] bytes = s.getBytes(Constants.DEFAULT_CHARSET);
         return Optional.ofNullable(bytes);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to