Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
naviyij674
Contributor II
Contributor II

Encoding problem in runtime

Hi all,

I've got an encoding problem in my project. The project contains 2 routes. The first route drops a XML-file in a directory, using a cMessagingEndpoint component. The second route picks it up with a cFile component, encoding set as UTF-8.

Apparently the first route doesn't drop the file with the right encoding, so the second route crashes with error 'org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence', caused by an 'ü'.

I've configured this JVM parameter in the wrapper config: wrapper.java.additional.13=-Dfile.encoding=UTF-8, but that's not solving the issue.

What could cause or solve this issue? Is there a way to set the encoding in the cMessagingEndpoint component?

Labels (2)
2 Replies
Xiaodi_Shi
Support
Support

Hello,

Editing the ***wrapper.conf file with below parameter is applicable for Runtime which is launched from a service.

wrapper.java.additional.NN=-Dfile.encoding=UTF-8

From the Job level(Studio side):
Click the Run tab > Advanced settings > select Use specific JVM arguments > New > enter -Dfile.encoding=UTF-8.

In addition to that, in cRest component you can set Response class as byte[] and directly write the content to the file without any encoding set on cFile component.

Best regards

Sabrina

naviyij674
Contributor II
Contributor II
Author

Hi Sabrina,

Like I said, I already configured the parameter in the wrapper config file and my project does not contain jobs.

Unfortunately, the first route modifies the incoming XML, so we can't store it directly to the file. Are there other ways to solve this issue?