Skip to main content
Solved

Encoding of diacritics in HTTPCaller


friesewoudloper
Participant
Forum|alt.badge.img+1

When I do this api request using an HTTPCaller:

1https://ckan.dataplatform.nl/api/3/action/tag_show?id=enquête

I get this error:

1HTTPCaller_7(HTTPFactory): Received HTTP response header: 'HTTP/1.0 400 Bad request' from 'https://ckan.dataplatform.nl/api/3/action/tag_show?id=enquête'

When I do the same request from within my browser (Chrome and Firefox), I don't get an error.

I tried adding header parameters to my request:

1Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: nl,en-US;q=0.7,en;q=0.3

But this didn't work.

Something is going wrong when HTTPCaller encodes diacritics. How do I fix this?

Best answer by david_r

You have two options.

Either pass the parameter values through the TextEncoder set to URL-encoding first:

Or pass them through the query string parameters in the HTTPCaller, it will do the encoding for you:

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • Best Answer
  • October 17, 2018

You have two options.

Either pass the parameter values through the TextEncoder set to URL-encoding first:

Or pass them through the query string parameters in the HTTPCaller, it will do the encoding for you:


nielsgerrits
VIP
Forum|alt.badge.img+59
david_r wrote:

You have two options.

Either pass the parameter values through the TextEncoder set to URL-encoding first:

Or pass them through the query string parameters in the HTTPCaller, it will do the encoding for you:

Exactly this. In 2016 the body needs to be encoded too. Took me a while to find out strange API responses. Worked in test, failed in prod, no usable feedback :-)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings