We are using the Web API REST endpoints of Microsoft CRM Dynamics online.
We try to create a new entry using a POST to the following URL https://OUR-ORG.crm4.dynamics.com/api/data/v9.0/customentities
We get success when the data contains normal characters, but as soon as a text property contains special characters like this
één
The request fails.
So sending
een
is successful.
We are setting the "Content-Type" header to "application/json; charset=UTF-8"
---- programming language --- When we are using JAVA it fails.
URL crmURL = new URL(fullOdataURL);
HttpsURLConnection con = (HttpsURLConnection) crmURL.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
con.setRequestProperty("Authorization", "Bearer " + accesstoken);
con.setRequestProperty("OData-MaxVersion", "4.0");
con.setRequestProperty("OData-Version", "4.0");
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
wr.writeBytes(baaslogentryJSON.toString());
wr.flush();
wr.close();
When we use Postman to replay the request, the request is accepted.
So this becomes a JAVA question.
application/json; charset=UTF-8
won't help if your code sends the data encoded as ASCII and mangles non-ANSI characters. Use Fiddler or another debugging proxy to check what's actually being sent to the HTTP service. I suspect you'll see that the request body is already mangled – Panagiotis Kanavos