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

Non-breaking space (0xA0) in HTML macro causes CSS parsing to fail silently

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 9.0.3, 9.2.3, 8.5.21
    • Editor - Core
    • None

      Problem

      When a non-breaking space character (0xA0) is present at the beginning of a CSS rule inside the HTML macro, the rule fails to apply due to invalid parsing. This issue is difficult to detect because the non-breaking space looks identical to a regular space (0x20).

      Environment

      Confluence DC

      Steps to Reproduce

      1. Edit a Confluence page.
      2. Ensure the HTML macro is enabled, and insert it into the page.
      3. Paste the following content inside the macro:
        <style>
        #main-content {
          border-top: solid 1px red;
        }
        </style>
        
      4. Save and publish the page. (A red line should appear at the top of the content area.)
      5. Edit the page again.
      6. Copy the line border-top: solid 1px red; without including leading spaces.
      7. Paste it as a new line and change border-top to border-bottom, so the block looks like this:
        <style>
        #main-content {
          border-top: solid 1px red;
          border-bottom: solid 1px red;
        }
        </style>
        
      8. Save and publish the page.

      Expected Results

      Both border-top and border-bottom styles should be applied correctly.

      Actual Results

      Only border-top is applied.
      The line with the non-breaking space (0xA0) is ignored by the browser's CSS parser and does not apply.

      Workaround

      • Manually delete and retype the space before the affected line using the spacebar.
      • Manually copy the whole line including the leading spaces.
      • Alternatively, pre-clean the content in a plain-text editor (e.g., VS Code) before pasting into the HTML macro.

      Notes

        1. leading_spaces.mov
          6.38 MB
          Lei Wang

            [CONFSERVER-99546] Non-breaking space (0xA0) in HTML macro causes CSS parsing to fail silently

            Jiri Hronik made changes -
            Status Original: Needs Triage [ 10030 ] New: Gathering Impact [ 12072 ]
            SET Analytics Bot made changes -
            Support reference count New: 1
            Lei Wang made changes -
            Description Original: h3. Problem
            When a non-breaking space character (0xA0) is present at the beginning of a CSS rule inside the HTML macro, the rule fails to apply due to invalid parsing. This issue is difficult to detect because the non-breaking space looks identical to a regular space (0x20).

            h3. Environment
            Confluence DC

            h3. Steps to Reproduce
            # Edit a Confluence page.
            # Ensure the HTML macro is *enabled*, and insert it into the page.
            # Paste the following content inside the macro:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page. (A red line should appear at the top of the content area.)
            # Edit the page again.
            # Copy the line {{border-top: solid 1px red;}} without including leading spaces.
            # Paste it as a new line and change border-top to border-bottom, so the block looks like this:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
              border-bottom: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page.

            h3. Expected Results
            Both border-top and border-bottom styles should be applied correctly.

            h3. Actual Results
            Only border-top is applied.
            The line with the non-breaking space (0xA0) is ignored by the browser's CSS parser and does not apply.

            h3. Workaround
            * Manually delete and retype the space before the affected line using the spacebar.
            * Manually copy the whole line including the leading spaces.
            * Alternatively, pre-clean the content in a plain-text editor (e.g., VS Code) before pasting into the HTML macro.

            h3. Notes
            * Replicate screen recording attached.
            * The non-breaking space (0xA0, encoded as 0xC2A0 in UTF-8) is not recognized as valid whitespace in CSS. It is often introduced during copy-paste from Confluence macros, code blocks, or other rich-text sources. See this bug: https://jira.atlassian.com/browse/CONFSERVER-61142
            New: h3. Problem
            When a non-breaking space character (0xA0) is present at the beginning of a CSS rule inside the HTML macro, the rule fails to apply due to invalid parsing. This issue is difficult to detect because the non-breaking space looks identical to a regular space (0x20).

            h3. Environment
            Confluence DC

            h3. Steps to Reproduce
            # Edit a Confluence page.
            # Ensure the HTML macro is *enabled*, and insert it into the page.
            # Paste the following content inside the macro:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page. (A red line should appear at the top of the content area.)
            # Edit the page again.
            # Copy the line {{border-top: solid 1px red;}} without including leading spaces.
            # Paste it as a new line and change border-top to border-bottom, so the block looks like this:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
              border-bottom: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page.

            h3. Expected Results
            Both border-top and border-bottom styles should be applied correctly.

            h3. Actual Results
            Only border-top is applied.
            The line with the non-breaking space (0xA0) is ignored by the browser's CSS parser and does not apply.

            h3. Workaround
            * Manually delete and retype the space before the affected line using the spacebar.
            * Manually copy the whole line including the leading spaces.
            * Alternatively, pre-clean the content in a plain-text editor (e.g., VS Code) before pasting into the HTML macro.

            h3. Notes
            * Replicate screen recording attached. [^leading_spaces.mov]
            * The non-breaking space (0xA0, encoded as 0xC2A0 in UTF-8) is not recognized as valid whitespace in CSS. It is often introduced during copy-paste from Confluence macros, code blocks, or other rich-text sources. See this bug: https://jira.atlassian.com/browse/CONFSERVER-61142
            Lei Wang made changes -
            Attachment New: leading_spaces.mov [ 493726 ]
            Lei Wang made changes -
            Description Original: h3. Problem
            When a non-breaking space character (0xA0) is present at the beginning of a CSS rule inside the HTML macro, the rule fails to apply due to invalid parsing. This issue is difficult to detect because the non-breaking space looks identical to a regular space (0x20).

            h3. Environment
            Confluence DC

            h3. Steps to Reproduce
            # Edit a Confluence page.
            # Ensure the HTML macro is *enabled*, and insert it into the page.
            # Paste the following content inside the macro:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page. (A red line should appear at the top of the content area.)
            # Edit the page again.
            # Copy the line {{border-top: solid 1px red;}} without including leading spaces.
            # Paste it as a new line and change border-top to border-bottom, so the block looks like this:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
              border-bottom: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page.

            h3. Expected Results
            Both border-top and border-bottom styles should be applied correctly.

            h3. Actual Results
            Only border-top is applied.
            The line with the non-breaking space (0xA0) is ignored by the browser's CSS parser and does not apply.

            h3. Workaround
            * Manually delete and retype the space before the affected line using the spacebar.
            * Manually copy the whole line including the leading spaces.
            * Alternatively, pre-clean the content in a plain-text editor (e.g., VS Code) before pasting into the HTML macro.

            h3. Notes
            * Replicate screen recording attached. {attachment:id=3af8491b-8371-4490-9315-9868a3765f1a|issueId=8489246|width=200|name=leading_spaces_2025-04-04T03:00:48.103Z.mov}
            * The non-breaking space (0xA0, encoded as 0xC2A0 in UTF-8) is not recognized as valid whitespace in CSS. It is often introduced during copy-paste from Confluence macros, code blocks, or other rich-text sources. See this bug: https://jira.atlassian.com/browse/CONFSERVER-61142
            New: h3. Problem
            When a non-breaking space character (0xA0) is present at the beginning of a CSS rule inside the HTML macro, the rule fails to apply due to invalid parsing. This issue is difficult to detect because the non-breaking space looks identical to a regular space (0x20).

            h3. Environment
            Confluence DC

            h3. Steps to Reproduce
            # Edit a Confluence page.
            # Ensure the HTML macro is *enabled*, and insert it into the page.
            # Paste the following content inside the macro:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page. (A red line should appear at the top of the content area.)
            # Edit the page again.
            # Copy the line {{border-top: solid 1px red;}} without including leading spaces.
            # Paste it as a new line and change border-top to border-bottom, so the block looks like this:
            {code}
            <style>
            #main-content {
              border-top: solid 1px red;
              border-bottom: solid 1px red;
            }
            </style>
            {code}
            # Save and publish the page.

            h3. Expected Results
            Both border-top and border-bottom styles should be applied correctly.

            h3. Actual Results
            Only border-top is applied.
            The line with the non-breaking space (0xA0) is ignored by the browser's CSS parser and does not apply.

            h3. Workaround
            * Manually delete and retype the space before the affected line using the spacebar.
            * Manually copy the whole line including the leading spaces.
            * Alternatively, pre-clean the content in a plain-text editor (e.g., VS Code) before pasting into the HTML macro.

            h3. Notes
            * Replicate screen recording attached.
            * The non-breaking space (0xA0, encoded as 0xC2A0 in UTF-8) is not recognized as valid whitespace in CSS. It is often introduced during copy-paste from Confluence macros, code blocks, or other rich-text sources. See this bug: https://jira.atlassian.com/browse/CONFSERVER-61142
            Lei Wang created issue -

              Unassigned Unassigned
              lwang3@atlassian.com Lei Wang
              Affected customers:
              2 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated: