Hi i am currently making an integration which should automatically generate Incidents.
I do however have a problem as the client want to include Swedish characters "ÅÄÖ" in the issue.
When i try to create a request equal to the JSON below.
{
"serviceDeskId":"62",
"requestTypeId":"135",
"requestFieldValues":
{
"summary":"[OP5 Generated]GMS - Garantisystem för NCTS loggövervakning företagstest"
}
}
I get the response
"{"message":"Invalid UTF-8 middle byte 0x72\n at [Source: org.apache.catalina.connector.CoyoteInputStream@25588092; line: 1, column: 116]"
When i change the summary text to not containing "ÅÄÖ" characters. The issue is created without a problem.
The headers that are set are "Accept = application/json", "Content-type=application/json" and "Authenticate = {basic auth string})
The request is being made with a Java application using the "Apache http" library.
I found the solution.
When applying a data to a http Post request with the "Apache http" library, you set an entity on the request object.
When creating and mapping the JSON string to the Entity object you need to apply an encoding.
"OLD" = not working
String jsonData = {STRING WITH JSON STRUCTURE}
StringEntity entity = new StringEntity(jsonData);
httpPost.setEntity(entity);
"NEW" = working
String jsonData = {STRING WITH JSON STRUCTURE}
StringEntity entity = new StringEntity(jsonData, "UTF-8");
httpPost.setEntity(entity);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.