Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML response encoding problem

Hello, all,

I've created a job, that making request to external REST service, by request to this job, and returning body as the XML file. 0683p000009LyTd.pngJobBut the response has a problem with encoding random chars inside a body.  Although, writing response content to file(in tHttpRequest _1) works fine.  Response from external REST service moves between components as String.0683p000009Ly8s.png

 

I've already try add to "Advanced settings" parameter  "-Dfile.encoding=UTF-8", but it hasn't worked.

 

Anyone have an idea, why does it can work incorrectly?

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thanks, all, for trying to help. The problem really places inside the tHttpRequest code. It reads a chunk of bytes from response stream, converts them into String and concatenates them. This algorithm works well if the response contains only ASCII symbols or response length less then 1024 byte(hardcoded size of the chunk). In other situations, it can split symbol. I've  moved creating String from bytes after reading the response and it's worked. I've attached my version of this component. The issue in bugtracker will be created later.


tHttpRequest.zip

View solution in original post

5 Replies
Jesperrekuh
Specialist
Specialist

Did you set your Header correctly? Something like:
"Content-type" : "application/xml; charset=utf-8"
Anonymous
Not applicable
Author

Yes. I added this header to tRESTResponse_1 component, 0683p000009LyDV.png

 

but it hasn't worked too.

 

Jesperrekuh
Specialist
Specialist

Annoying... could it be that the data is extracted from different source(tables) which has a different collation setup (LATIN-1_general)? The other thing I could come up with is UTF-16?

Anonymous
Not applicable
Author

External service returns correct XML. I guess, the problem appears inside components after tHttpRequest_1 or during moving between them.  I'll try to watch transformation this response in debugger.

Anonymous
Not applicable
Author

Thanks, all, for trying to help. The problem really places inside the tHttpRequest code. It reads a chunk of bytes from response stream, converts them into String and concatenates them. This algorithm works well if the response contains only ASCII symbols or response length less then 1024 byte(hardcoded size of the chunk). In other situations, it can split symbol. I've  moved creating String from bytes after reading the response and it's worked. I've attached my version of this component. The issue in bugtracker will be created later.


tHttpRequest.zip