Skip to main content
Solved

Encoding of diacritics in HTTPCaller

  • October 17, 2018
  • 2 replies
  • 22 views

friesewoudloper
Participant
Forum|alt.badge.img+1

When I do this api request using an HTTPCaller:

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

I get this error:

HTTPCaller_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:

Accept: 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:

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+61

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 :-)