Skip to content

Match ActiveSupport for Unicode whitespace in the blank emulation - #2131

Open
sebxt wants to merge 1 commit into
Shopify:mainfrom
sebxt:fix/blank-unicode-whitespace
Open

sebxt wants to merge 1 commit into
Shopify:mainfrom
sebxt:fix/blank-unicode-whitespace

Conversation

@sebxt

@sebxt sebxt commented Oct 18, 2026

Copy link
Copy Markdown

Condition#liquid_blank? emulates ActiveSupport's String#blank? so that == blank behaves the same with and without ActiveSupport loaded. It used /\A\s*\z/, which only matches ASCII whitespace, while ActiveSupport uses /\A[[:space:]]*\z/. As a result " " (non-breaking space) or " " was blank with ActiveSupport and not blank without it.

This changes the regexp to /\A[[:space:]]*\z/ and adds a unit test covering a non-breaking space, an ideographic space, and an em space mixed with a newline.

bundle exec rake base_test passes, and the liquid-spec adapters in spec/ (including ruby_liquid_with_active_support.rb) report 0 failures.

Fixes #2130

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
@sebxt

sebxt commented Oct 18, 2026

Copy link
Copy Markdown
Author

I have signed the CLA!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blank treats Unicode whitespace differently depending on whether ActiveSupport is loaded

1 participant