Missed Team ’24? Catch up on announcements here.

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

Text encoding for output from getChildren JSON-RPC API in Confluence

Martin Stiborsky June 25, 2013

Hello,

I have troubles with "getChildren" method in Confluence JSON-RPC API.

For Confluence pages with special characters in title, the API returns wrong text - instead of the special/foreign characters, there are wrong characters. See example:

[
    {
        "version": 1,
        "parentId": 28148060,
        "permissions": 0,
        "id": 28835879,
        "space": "TEST",
        "title": "Copy of Will s��",
        "url": "https://confluence:8443/pages/viewpage.action?pageId=28835879"
    },
    {
        "version": 1,
        "parentId": 28148060,
        "permissions": 0,
        "id": 29753574,
        "space": "TEST",
        "title": "Special chars-�??�?�?b��",
        "url": "https://confluence:8443/pages/viewpage.action?pageId=29753574"
    },
    {
        "version": 3,
        "parentId": 28148060,
        "permissions": 0,
        "id": 28835875,
        "space": "TEST",
        "title": "Will s��",
        "url": "https://confluence:8443/pages/viewpage.action?pageId=28835875"
    }
]

Characters encoding in Confluence itself is ok, without problems. I did also the encoding test and all went fine (http://confluence.atlassian.com/admin/encodingtest.action).

About the getChildren API request - I tried some HTTP headers, like "Accept-Charset", but no change.

Content-Type : application/json; charset=utf-8
Accept-Charset : ISO-8859-1,utf-8;q=0.7,*;q=0.7

Is it bug, or I have something wrong here?

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
mnd July 8, 2014

The problem is that the character encoding in the plugin is ISO-8859-1, rather than UTF-8. Unfortunately the plugin does not respond to the Accept-Charset header, or the charset parameter in the Accept header. As an alternative I have submitted a pull request for the plugin to set the character encoding to UTF-8. Hopefully it will be merged, but if not, you could always customize the plugin and upload your changes manually. Here's the pull request with the code changes:

https://bitbucket.org/cmiller_atlassian/confluence-json-rpc-plugin/pull-request/5/set-character-encoding-to-utf-8-when/diff

Hope this helps!

0 votes
Deleted user August 27, 2013

To my knowledge, JSON resources must be encoded in UTF-8. Wikipedia states that it is the default charset.

You might try to set this as your preferred Accept-Charset. Also look at the response Headers.

Sergey Svishchev
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.
April 24, 2014
0 votes
Martin Stiborsky June 26, 2013

all this is related to Confluence 4.2.8, forgot to mention...

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events