I am making an app which returns data through api and adds them as assets,but the names of assets being added should undergo utf encoding because I am not able to upload a name which contains special characters like ' â,€™ ',Can you please show a solution to the problem
I have given you a word document which consists of my python code,please have a look at it,you might get clear understanding of it.Thankyou
I have attached a word document which has my python code,please go throw it so that it would be clear for you.Thankyou
Hi @Harshit Somani ,
thank you. I can confirm I'm able to reproduce the problem. When I send some "non standard" characters, I get error message:
Invalid UTF-8 start byte 0xfd
at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 91] (through reference chain: com.atlassian.servicedesk.assets.asset.dto.ImmutableAssetDTO$Json["label"]->com.atlassian.servicedesk.assets.common.dto.ImmutableLabelDTO$Json["value"])
I understand that you are trying to use the Insights REST API in order to add content from another site, but are unable to in some cases due to some characters not being in UTF-8.
I came across another set of users that appears to have had a very similar problem over in https://community.atlassian.com/t5/Answers-Developer-Questions/Re-Re-ResponseStatusException-when-calling-REST-method/qaq-p/622711/comment-id/115788#M115788 in that post, Philip Stone mentioned the means by which he resolved this:
I enclosed the charset with a " in the header like this 'application/json;charset="UTF-8"' and it's working pretty well now.
Which you should be able to just adjust your header from
into something more like
"Content-Type": "application/json; charset='UTF-8'"
to effect this change. This should insure that the payload being sent to the Atlassian site is using that character set.
Try this first. While I'm not well versed in using python, perhaps we can try to troubleshoot this further in order to better understand ways to get past this problem.
If that doesn't work, then take a look over at https://stackoverflow.com/questions/46408051/python-json-load-set-encoding-to-utf-8
The suggestion there is to instead decode the initial json payload to make sure that content is all in UTF-8 first. The method suggested there stores this a file first. I think this would be a better approach anyways, since it sounds like the source is not using UTF-8 encoding here.
If this does not work, please let me know what response you get back from this kind of call. Is there an error returned in the REST call response? Or is the request accepted, but appearing incorrect in some way?
We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan. &nb...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events