cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

HTTP Client snap issue encoding diacritical marks/accents

whaleyl
New Contributor III

Hello all! Hoping for some helpful suggestions or insight regarding an issue we're facing with the new HTTP Client snap.

We're sending a POST request with a JSON body. Within the body are street addresses, and some addresses contain diacritical marks/accents. An example would be "Houssiรจres".

We're supplying the body ($body) from an input Mapper into the snap as a raw entity, with the Content-Type header set to application/json:

whaleyl_0-1698680558282.png

I can't supply the full input body as it contains PII unfortunately, but the street address is supplied within the body like so. You can see the accent mark in question:

whaleyl_1-1698680620843.png

On debug, the snap parses the input body into a string labeled "requestString" within the response body, and within the string the accented character is shown as an unrecognized character:

whaleyl_3-1698680865482.png

The encoding issue is causing the endpoint we're POSTing to to respond with a 400:

whaleyl_4-1698681314029.png

So, is there some way I can combat this/force the snap to correctly encode similar strings within the request body? Maybe via JS within the raw entity in the snap, somehow? Anything I'm overlooking here that someone else has caught?

For context this isn't an issue we've faced with the older REST POST snap, but we like the extended functionality of the HTTP Client snap, and would prefer to use it (if feasible).

Thank you!

1 ACCEPTED SOLUTION

whaleyl
New Contributor III

UPDATE: I seem to have already fixed my own issue, hopefully this helps someone however if they make the same mistake I did.

My Content-Type header in my request wasn't specifying UTF-8 for encoding purposes, so I updated it to do so:

whaleyl_0-1698682630310.png

I assume the REST POST snap might have been defaulting to UTF-8 which is why it worked for me even though I was only supplying "application/json" without the charset, and in comparison the HTTP Client snap does not (?) I'm unclear. In any case, easy solution.

View solution in original post

1 REPLY 1

whaleyl
New Contributor III

UPDATE: I seem to have already fixed my own issue, hopefully this helps someone however if they make the same mistake I did.

My Content-Type header in my request wasn't specifying UTF-8 for encoding purposes, so I updated it to do so:

whaleyl_0-1698682630310.png

I assume the REST POST snap might have been defaulting to UTF-8 which is why it worked for me even though I was only supplying "application/json" without the charset, and in comparison the HTTP Client snap does not (?) I'm unclear. In any case, easy solution.