How to Fix Unwanted Characters in TYPO3 RTE

Are you frustrated with those mysterious   characters that appear when adding new lines in your TYPO3 Rich Text Editor? You're not alone. This common issue plagues many TYPO3 developers and content editors, but fortunately, there's a straightforward solution. In this comprehensive guide, we'll walk through exactly why this happens and how to eliminate these unwanted characters across different TYPO3 versions.

When working with the Rich Text Editor (RTE) in TYPO3, you might notice that pressing Enter to create a new line adds unwanted &nbsp ; characters to your HTML output. This happens because of how the RTE transformation processes your content.

These extra non-breaking spaces can cause:

  • Inconsistent spacing in your rendered content
  • SEO issues with unnecessary markup
  • Styling problems across different devices
  • Headaches for developers and content editors alike

Understanding RTE Transformations in TYPO3

Before diving into the solution, it's important to understand what's happening behind the scenes. The TYPO3 RTE uses transformation modes to process content before saving it to the database and before rendering it on the frontend.

The default transformation includes the css_transform mode, which is often the culprit behind those pesky   characters.

Overriding RTE Transformation Mode

The core solution involves modifying the transformation mode used by the RTE. Let's explore how to implement this fix across different TYPO3 versions.

For TYPO3 v11

In TYPO3 v11, you can modify your TypoScript setup to override the default transformation mode:

RTE.default.proc.overruleMode = detectbrokenlinks,ts_links

This configuration removes the problematic css_transform mode while preserving other important functionality like link detection.

Alternatively, for a more radical approach:

RTE.default.proc.overruleMode = none

Note: Using none disables all transformations, which might not be suitable for all use cases.

For TYPO3 v12

TYPO3 v12 introduced some changes to the RTE handling, but the approach remains similar:

page.RTE.default.proc.overruleMode = detectbrokenlinks,ts_links

You can also define this in your site configuration YAML file:

RTE:
  default:
    proc:
      overruleMode: 'detectbrokenlinks,ts_links'

For TYPO3 v13

In the latest TYPO3 v13, the configuration can be defined in your site configuration:

RTE:
  config:
    processing:
      mode: 'detectbrokenlinks,ts_links'

For backward compatibility, the TypoScript approach still works:

RTE.default.proc.overruleMode = detectbrokenlinks,ts_links

Implementation in Different Contexts

For a Single Content Element Type
If you only want to modify the behavior for specific content elements, you can target them directly:

# Only for text elements
tt_content.text.RTE.default.proc.overruleMode = detectbrokenlinks,ts_links

For Specific RTE Configurations

If you have custom RTE configurations:

RTE.config.myCustomRTE.proc.overruleMode = detectbrokenlinks,ts_links

Advanced Configuration Options

For more granular control, TYPO3 offers additional configuration options:

Preserving Specific HTML Tags

  • RTE.default.proc.preserveTags = br,ul,ol,li,p

Custom Processing Rules

  • RTE.default.proc.entryHTMLparser_db.tags.p.allowedAttribs = class,style

Pro Tips for Testing TYPO3 Setup & Configuration

When implementing these changes, always test thoroughly in a development environment before deploying to production. The behavior can vary depending on your specific TYPO3 setup, extensions, and content requirements.
Add this useful debug snippet to verify your RTE transformation settings:

config.debug = 1
config.contentObjectExceptionHandler = 0

Compatibility with CKEditor in TYPO3

Since TYPO3 v8, CKEditor is the default RTE implementation. The solutions above work with CKEditor, but there are some additional considerations:

 For TYPO3 v11 and v12 with CKEditor 5:
 

editor:
  config:
    enterMode: CKEDITOR.ENTER_P
    shiftEnterMode: CKEDITOR.ENTER_BR

For TYPO3 v13:
imports:
  - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" }
editor:
  config:
    enterMode: 1
    shiftEnterMode: 2

By adjusting the transformation mode of your TYPO3 RTE, you can eliminate those frustrating   characters once and for all. This not only improves the cleanliness of your HTML output but also ensures more consistent rendering across different devices and browsers.
Remember that the specific solution might vary slightly depending on your TYPO3 version and setup, so don't hesitate to test different approaches to find what works best for your specific use case.
Need more help with TYPO3 RTE configurations or other TYPO3 development challenges? Feel free to explore our other TYPO3 guides or reach out to our expert team for personalized assistance.
 

The TYPO3 RTE adds these characters during the css_transform process to preserve formatting and spacing in the HTML output. While intended to help maintain visual consistency, it often leads to unwanted extra spaces.

It depends on which mode you choose. Using detectbrokenlinks,ts_links preserves link handling while removing unwanted spaces. Using none disables all transformations, which might affect other features.

Yes, you can apply this solution to any RTE configuration in TYPO3, including custom ones you've defined for specific content types.

View the HTML source of your rendered page and check for   characters between paragraph elements. They should be gone after implementing this solution.

CKEditor is the specific implementation of the Rich Text Editor used in modern TYPO3 versions. The RTE is the concept, while CKEditor is the actual tool implementing it.

Post a Comment

×

    Got answer to the question you were looking for?