Infobip SMS 400 on Unicode text: set the JSON content type with a UTF-8 charset
Shows how to fix infobip SMS 400 on Unicode text: set the JSON content type with a UTF-8 charset. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Set the content type to application/json with an explicit UTF-8 charset on the request headers. Without the charset declaration the API rejects non-ASCII message bodies with a 400 while ASCII text sails through, which makes it look like a message problem when it is a header problem.
Steps
- Set the content type to application/json with an explicit UTF-8 charset on the request headers. Without the charset declaration the API rejects non-ASCII message bodies with a 400 while ASCII text sails through, which makes it look like a message problem when it is a header problem. Send accept application/json alongside it, keep the from, to, and text fields in the JSON body, and Unicode messages go through.
When to use
You are seeing this: Send accept application/json alongside it, keep the from, to, and text fields in the JSON body, and Unicode messages go through. Use this skill when you run into "Infobip SMS 400 on Unicode text: set the JSON content type with a UTF-8 charset".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.