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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9a948c67e1 Remote Work Configurations Won't Work Because of Turkish 
Characters #3356
     new f26eb7bcbb Merge pull request #3362 from nadment/3307
9a948c67e1 is described below

commit 9a948c67e1716d903562543912606daf413d45f9
Author: Nicolas Adment <[email protected]>
AuthorDate: Wed Nov 8 18:18:27 2023 +0100

    Remote Work Configurations Won't Work Because of Turkish
    Characters #3356
    
    Force sending/receiving XML to UTF-8
---
 engine/src/main/java/org/apache/hop/server/HopServer.java      | 10 ++++++----
 .../main/java/org/apache/hop/www/RegisterPipelineServlet.java  |  6 +++---
 .../main/java/org/apache/hop/www/RegisterWorkflowServlet.java  |  6 +++---
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/engine/src/main/java/org/apache/hop/server/HopServer.java 
b/engine/src/main/java/org/apache/hop/server/HopServer.java
index eeef474a11..2445029542 100644
--- a/engine/src/main/java/org/apache/hop/server/HopServer.java
+++ b/engine/src/main/java/org/apache/hop/server/HopServer.java
@@ -513,8 +513,8 @@ public class HopServer extends HopMetadataBase implements 
Cloneable, IXml, IHopM
 
   HttpPost buildSendXmlMethod(IVariables variables, byte[] content, String 
service)
       throws Exception {
-    String encoding = Const.getEnvironmentVariable("file.encoding", 
Const.XML_ENCODING);
-    return buildSendMethod(variables, content, encoding, service, "text/xml");
+    String encoding = Const.XML_ENCODING;
+    return buildSendMethod(variables, content, encoding, service, "text/xml"); 
   }
 
   // Method is defined as package-protected in order to be accessible by unit 
tests
@@ -542,7 +542,7 @@ public class HopServer extends HopMetadataBase implements 
Cloneable, IXml, IHopM
   public String sendXml(IVariables variables, String xml, String service) 
throws Exception {
     String encoding = getXmlEncoding(xml);
     HttpPost method =
-        buildSendMethod(variables, xml.getBytes(encoding), encoding, service, 
"text/xml");
+        buildSendMethod(variables, xml.getBytes(encoding), encoding, service, 
"text/xml"); 
     try {
       return executeAuth(variables, method);
     } finally {
@@ -579,7 +579,8 @@ public class HopServer extends HopMetadataBase implements 
Cloneable, IXml, IHopM
     if (matcher.find()) {
       return matcher.group();
     }
-    return Const.getEnvironmentVariable("file.encoding", Const.XML_ENCODING);
+
+    return Const.XML_ENCODING;
   }
 
   /** Throws if not ok */
@@ -1348,3 +1349,4 @@ public class HopServer extends HopMetadataBase implements 
Cloneable, IXml, IHopM
     this.propertiesMasterName = propertiesMasterName;
   }
 }
+
diff --git 
a/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java 
b/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java
index 724ce16469..8b4af9fad5 100644
--- a/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/RegisterPipelineServlet.java
@@ -24,10 +24,10 @@ import org.apache.hop.pipeline.PipelineConfiguration;
 import org.apache.hop.pipeline.PipelineMeta;
 import org.apache.hop.pipeline.engine.IPipelineEngine;
 import org.json.simple.parser.ParseException;
-
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 
 @HopServerServlet(id = "registerPipeline", name = "Add a pipeline to the 
server")
 public class RegisterPipelineServlet extends BaseWorkflowServlet {
@@ -48,7 +48,7 @@ public class RegisterPipelineServlet extends 
BaseWorkflowServlet {
       IVariables variables)
       throws IOException, HopException, HopException, ParseException {
 
-    final String xml = IOUtils.toString(request.getInputStream(), 
request.getCharacterEncoding());
+    final String xml = IOUtils.toString(request.getInputStream(), 
StandardCharsets.UTF_8);
 
     // Parse the XML, create a pipeline configuration
     PipelineConfiguration pipelineConfiguration = 
PipelineConfiguration.fromXml(xml);
diff --git 
a/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java 
b/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java
index c6d059dbd6..a47eb619c6 100644
--- a/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java
+++ b/engine/src/main/java/org/apache/hop/www/RegisterWorkflowServlet.java
@@ -24,10 +24,10 @@ import org.apache.hop.workflow.WorkflowConfiguration;
 import org.apache.hop.workflow.WorkflowMeta;
 import org.apache.hop.workflow.engine.IWorkflowEngine;
 import org.json.simple.parser.ParseException;
-
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 
 @HopServerServlet(id = "registerWorkflow", name = "Add a workflow to the 
server")
 public class RegisterWorkflowServlet extends BaseWorkflowServlet {
@@ -48,7 +48,7 @@ public class RegisterWorkflowServlet extends 
BaseWorkflowServlet {
       IVariables variables)
       throws IOException, HopException, HopException, ParseException {
 
-    final String xml = IOUtils.toString(request.getInputStream(), 
request.getCharacterEncoding());
+    final String xml = IOUtils.toString(request.getInputStream(), 
StandardCharsets.UTF_8);
 
     // Parse the XML, create a workflow configuration
     WorkflowConfiguration workflowConfiguration = 
WorkflowConfiguration.fromXml(xml, variables);

Reply via email to