I am trying to add assets through utf-8,but it seems like not working

Harshit Somani January 18, 2021

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

2 answers

1 accepted

0 votes
Answer accepted
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2021

Hi @Harshit Somani ,

would you please provide us information, how exactly does your request look like? Thank you.

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2021

Hi @Harshit Somani ,

I got notification, that you've mentioned me here, but I can't see any response here. Would you please try it again? Thank you.

Harshit Somani January 19, 2021

Hai @Hana Kučerová https://docs.google.com/document/d/1GC9fSC61BtWhdoTLBZTHxUsNmPiY2wMmzT5OqvQuY80/edit?usp=sharing 

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

Harshit Somani January 19, 2021

@Hana Kučerová 

I have attached a word document which has my python code,please go throw it so that it would be clear for you.Thankyou

https://docs.google.com/document/d/1GC9fSC61BtWhdoTLBZTHxUsNmPiY2wMmzT5OqvQuY80/edit?usp=sharing 

Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2021

Hi @Harshit Somani ,

your response ends in spam, because of the provided URL. You would need to paste the code here. Thank you.

Harshit Somani January 19, 2021

here is my code

 

Harshit Somani January 19, 2021

here is my code

 

Harshit Somani January 19, 2021

you can see my github repository here

 

Like Hana Kučerová likes this
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2021

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"])
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2021

It definitely seems like a bug to me. Probably it will be the best to contact official support. To be honest I can't think of any workaround, which would work.

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 26, 2021

Hi,

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

"Content-Type": "application/json"

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?

 

Andy

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events