Jira Insight - Rest API - Invalid UTF-8 middle byte

Hello,
I’ve encountered an error when I try to create objects in my Jira Insight instance. Whenever there are some sort of a “special character” in any of the attribute values I do get an Invalid UTF-8 middle byte 0x?? error

Does anyone know which encoding is the REST API body suppose to be in in order for it to pass the encoding check? I’ve had similar issues but with Jira and Confluence where the body need to be HTML encoded.

The Jira Insight attributes are of the default text type and I’ve noticed that the following symbols has been an issue (-_?åäöé) I’ve managed to convert them to Windows-1252 encoding but it only helps in some cases and some cases actually converts the value to an disallowed symbol, making the whole convertion a nightmare.

Example of error message:

{"errorMessages":["Invalid UTF-8 middle byte 0x3f\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 72, column: 85] (through reference chain: com.riadalabs.jira.plugins.insight.channel.web.api.r
est.model.ObjectInEntry[\"attributes\"]->java.util.ArrayList[8]->com.riadalabs.jira.plugins.insight.channel.web.api.rest.model.ObjectAttributeInEntry[\"objectAttributeValues\"]->java.util.ArrayList[0]->com.riadalabs.jira.plugins.insight.channel.web.api.rest.model.ObjectAttributeValueInEntry[\"value\"])"],"errors"
:{}}

Would appreciate any help
// Tony

I solved the POST and PUT methods by updating the ContentType to contain the charset but I now have the same issue when I’m using GET, the response isn’t returning UTF-8 standard.

ContentType = "application/json; charset=UTF-8"

I’ve found the solution for the GET method as well

You need to convert the string (repsonse) from Windows-1252 to UTF-8

[System.Text.Encoding]::UTF8.GetString([System.Text.Encoding]::Default.GetBytes("ö"))
It only works on non-capital letters :frowning:

@TonyLanglet,

Sorry that you’re still struggling with the encoding. Given your update, I’m quite sure you have identified a bug. Can you please report that through:

1 Like

Thanks for your post, @TonyLanglet. I got a similar error message and were left clueless.

Your post helped to get it work, only with a very small change: with hypen in Content-Type it ran, like: “Content-Type”: “application/json; charset=UTF-8”,

@ibuchanan: Perhaps the error message could be more clear …

Some updates, I’ve now reported the issue to the development team and there are two bugs recorded for the issue.

https://jira.atlassian.com/browse/JSDCLOUD-12511

https://jira.atlassian.com/browse/JSDCLOUD-12510