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

Code macro creates no-break spaces instead of ordinary spaces in copy mode

    XMLWordPrintable

Details

    Description

      Steps to Reproduce

      1. Create a new page with a code block macro
      2. Enter this text into the code block (two lines are required because it strips whitespace from the first line):
        line 1
                line 2
        
        • NB: This was created by typing ordinary spaces with the space bar
      3. Save the page
      4. Double click inside the code block to highlight all the text.
        • NB: You will see the text indent slightly, and the numbers that were green are now black (syntax highlighting is off). This is the copy mode I am referring to.
      5. Copy the text
      6. Paste it into this character identifier and convert it
      7. You will see that the indenting spaces are no-break spaces:
        LATIN SMALL LETTER N
        LATIN SMALL LETTER E
        SPACE
        DIGIT ONE
        SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        NO-BREAK SPACE
        LATIN SMALL LETTER L
        LATIN SMALL LETTER I
        LATIN SMALL LETTER N
        LATIN SMALL LETTER E
        SPACE
        DIGIT TWO
        

      Explanation

      This is by design. This article explains the behaviour of browsers and why they require non-breaking spaces in order to not compact all the spaces into a single whitespace character. Some text editors will display these characters as non-breaking spaces, while some will not.

      Workarounds

      1. You may not need to do anything at all - if you want to retain the formatting, these characters will simply ensure that the whitespace is exactly as intended.
      2. Edit the page and copy the contents of the code block from there.
      3. Click outside the code block to take it out of copy mode (so the syntax highlighting returns), and copy the contents of the code block by clicking outside of the box and dragging the selection area over the entire block. Repeat the same character identification test and you will see the characters are simply 'SPACE'.
        See the attached video for a demonstration.
        NB: This will not work for OpenOffice/LibreOffice, as explained here.
      4. Copy and paste into a different text editor (eg Sublime Text), and then copy/paste the text again from there into your final destination (eg OpenOffice).
      5. Find and replace the characters in your text editor, eg find '\u00a0' and replace with ' '

      Attachments

        Issue Links

          Activity

            People

              shaffenden Steve Haffenden (Inactive)
              dunterwurzacher Denise Unterwurzacher [Atlassian] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: