Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Character encoding in SAL Request

Stefan Ernst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2015

Hello,

I have this very simple SAL request object

Request request = requestFactory.createRequest(methodType, baseUrl + requestURL);

String returnValue = request.execute();

that queries a Confluence web services. When I view returnValue in debugger, all umlauts in the JSON response are badly encoded. How can I prevent this? Do I need to supply a request header?

The same request works fine in REST API browser.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2015

Hi Stefan,

You are right, try to add header:

"Content-Type", "application/json; charset=UTF-8"
Stefan Ernst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2015

Hi, unfortunately that didn't help code: request = request.setHeader("Content-Type", "application/json; charset=UTF-8"); String returnValue = request.execute(); result: "id": "98307", "type": "page", "title": "Prettify the page with an image (step 4 of 9) Umlaute ü ä U;", I might try another encoding

Volodymyr Krupach
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2015

If it's fine in the REST API browser, you can copy all the headers from it and it should give you the same response. Then you can find odd headers commenting them one-by-one.

TAGS
AUG Leaders

Atlassian Community Events