0

The return I am looking for, looks like this in the API sandbox (Browser driven):

{
"reviewId": "2887600825207199304",
"rating": 5,
"comments": "Abe Froeman  provided a “seamless†gutter experience.  Abe managed the scheduling, and Ferris and Cameron, with 15-30+ years of experienced, executed the job beautifully.  Extremely diligent workers.  Looks very attractive.  Would highly recommend for future jobs.",
"title": null,
...
..
.

But in the back end, when I issue the curl statement:

zak $ curl -d  "$(cat input.json)" \
> -H "Content-Type: application/json" \
> -H "Accept: application/json" \
> -X POST "https://api/xx.com/v1/xxx?sindex=0&count=30&api_key=..."

My return looks like

{
"reviewId": "2887600825207199304",
"rating": 5,
"comments": "Abe Froeman  provided a “seamlessâ€zak $  <-- Broken

All my research ends up in questions about encoding the URL .. Not dealing with the response -- IE THIS QUESTION

Problem: Non UTF ( I think! ) character from API breaking cURL response

Attempts: Have been fruitless, I've tried many different flags from man curl -- none seem to help

Question: How do I get cURL to ignore the erroneous characters returned from an API?

Zak
  • 6,976
  • 2
  • 26
  • 48
  • Doesn't it just break on the console? What happens if you let curl store it to a file? – Emanuel P Feb 24 '23 at 21:28
  • Now that DOES work .. Why would the CLI fail here? – Zak Feb 24 '23 at 21:49
  • Because the cli only handles utf-8. You can't print binary data on the console (which is what non-utf8 bytes are) – Emanuel P Feb 24 '23 at 21:50
  • Either point me to an SO question that's a duplicate, so we can close this properly, or answer it with your explanation and I'll accept. – Zak Feb 24 '23 at 21:53

0 Answers0