Issue: Shopify’s product description editor automatically removes non-breaking space entities ( ) when users switch between code and preview modes, even though these are intentionally placed (e.g., between numbers and units like “10 bar”).
Explanations provided:
This is intentional behavior, not a bug
Shopify’s Liquid templating engine escapes special characters by design
Theme code may include escape string handlers that strip these entities
Suggested workarounds:
Use CSS properties like white-space: nowrap; for layout control
Apply JSON filters with string replacement in Liquid code (example provided using | json | replace filters)
Status: The original poster reported the issue resolved temporarily on its own, though another user later requested clarification on implementing the solutions, indicating the problem persists for some users.
Summarized with AI on October 31.
AI used: claude-sonnet-4-5-20250929.
I’m editing the product description in the html code editor mode, so I’m marking up where I use non-breaking space between a number and a unit of measurement. For example,
10 bar
But today I noticed that Shopify just deletes non-breaking space after switching to preview mode and back to code editing. However, Shopify itself places the but not where I need them.
you could consider using CSS properties like white-space: nowrap; or adjusting the layout and styling to accommodate the desired spacing. Shopify’s code editor has a feature that automatically removes non-breaking spaces ( ) when switching between preview mode and code editing mode. This behavior is intentional and not an error.
I didn’t even exited the product card editor. I just used the “code mode” button for the description, wroted the text and used “view mode” and then “code mode” again.
But thank you for your reply. This problem was temporary for me, but now everything is ok, I didn’t notice it anymore.
I have the same issue - Shopify removes non-breaking spaces ( ) - and I have read all this thread but I was not able to understand what am I supposed to do
Could you let me know if you found a solution to add non-breaking spaces in product descriptions and other texts?