Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-28319

Unexpected unicode characters inserted into code block

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Medium
    • None
    • 5.0.1
    • None
    • Windows 7, 64-bit

    Description

      1. Create a page containing an html/xml code block containing the following content:
        <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
        </settings>
        
      2. Save the page
      3. Double click on the code block, copy the contents into the clipboard.
      4. Paste the clipboard into an editor (I use textpad) and save to ~/.m2/settings.xml.
      5. Run any Maven command, causing it to use settings.xml. Maven will complain:
      [FATAL] Non-parseable settings C:\.m2\settings.xml: start tag unexpected character \ua0 (position: START_DOCUMENT seen <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"\r\n\ua0... @2:2)  @ C:\.m2\settings.xml, line 2, column 2
      

      It seems that Confluence is inserting unicode characters into the clipboard (at the end of each line) which causes Maven to fail.

      Expected behavior: The clipboard should contain the exact same characters that were put into the code block in the first place.

      Workaround: Edit page, copy contents of code block into clipboard. Contents are now correct.

      I am setting priority to critical because this issue results in data loss/corruption for the typical use-case.

      Workaround:

      As the No Format macro doesn't allow for double click selection, one potential solution is to disable the Code Macro (by going to Confluence Admin > Manage Add-ons > System Add-ons) and then create a user macro called something like 'code' with the template: <ac:macro ac:name="noformat"><ac:plain-text-body><![CDATA[ $body]]></ac:plain-text-body></ac:macro>, which means that whenever someone goes to create a code macro, they instead make a No Format macro.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              a08d56c10c67 Gili
              Votes:
              19 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: