Trying to edit a page fails because of a Unicode character in the page title
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Trying to edit a specific page fails with the "This page is taking longer to load than usual" warning.
This occurs because of a Unicode character in the page title preventing the page to be loaded in the Editor. Displaying the page works flawlessly and, depending on the character, reading the title won't directly point to this problem.
The following sections describe how to identify this is the problem we are running into and how to resolve it.
Diagnosis
The "This page is taking longer to load than usual" warning may indicate other problems.
To identify this is the issue affecting your page, the following characteristics must apply:
- Displaying the affected page works.
- Trying to edit a page gives the user the "This page is taking longer to load than usual" warning in the UI and the Editor never loads.
- Collaborative Editing is enabled.
- This is reproduced in any browser and by any user.
- Editing other pages is possible.
A
WstxIOException
is thrown and logged inatlassian-confluence.log
file, similar to the below.- Generating a HAR file while reproducing the problem shows a Unicode character in the page title.
- Look at the
/rest/tinymce/1/content/<pageid>.json
request. - This request may not fail, responding with a 200 HTTP status.
- Checking the response JSON shows an Unicode character in the page title.
- Look at the
Solution 1
In order to have the page being editable again, we need to change its title. You won't be able to perform it from the UI since we cannot load the editor.
For that purpose, you may use a few REST API methods to change the page title as described below. The example below uses curl and jq in shell.
Setup a few environment variables highlighted below.
USER_NAME=<username> USER_PASSWORD=<password> CONFLUENCE_BASE_URL=<Confluence Base URL> PAGE_ID=<affected pageID> NEW_PAGE_TITLE="<new, unique page title without unicode charactes>"
Run the following command to extract the page content and metadata from the Confluence server.
REST_CONTENT_FULL_OUTPUT=$(curl -u ${USER_NAME}:${USER_PASSWORD} \ ${CONFLUENCE_BASE_URL}'/rest/api/content/'${PAGE_ID}'?expand=body.storage,version,space' 2>/dev/null)
Run the following command to save the page content to a local file, modifying the page title.
echo ${REST_CONTENT_FULL_OUTPUT} | \ jq '{body: {storage: {value: (.body.storage.value), representation: .body.storage.representation}}, id: .id, type: .type, title: "'${NEW_PAGE_TITLE}'", space: {key: .space.key}, version: {number: (.version.number + 1)}}' \ > modified-page-data.json
Using Confluence REST API call, update the page title running the following command.
curl -u ${USER_NAME}:${USER_PASSWORD} \ -X PUT \ -H 'Content-Type: application/json' \ --data @modified-page-data.json \ ${CONFLUENCE_BASE_URL}'/rest/api/content/'${PAGE_ID} 2>/dev/null \ | jq -r '.id'
If using the REST API is not an option in your instance, another solution would be to create a new page by copying the contents of the previous one.
Solution 2
It's also possible to disable Collaborative Editing, change the page title, and enable Collaborative Editing back. However, performing this will result in changes to page drafts and possible data loss. To avoid this, it's recommended to do so in a maintenance window when there's a limited to none user usage in Confluence so we can safely repair the page. For more information about this, please, click here.