Skip to content

fix: trim custom characters by Unicode code point - #955

Merged
harttle merged 1 commit into
harttle:masterfrom
jakezwang:fix/unicode-strip-characters
Sep 20, 2026
Merged

harttle merged 1 commit into
harttle:masterfrom
jakezwang:fix/unicode-strip-characters

Conversation

@jakezwang

Copy link
Copy Markdown
Contributor

Custom characters are already collected as Unicode code points, but strip, lstrip, and rstrip compare them against individual UTF-16 code units. For example, {{ "𠮷text𠮷" | strip: "𠮷" }} returns the unchanged input instead of text.

Scan complete code points at each boundary and retain string offsets for slicing. This avoids copying the full input and preserves lone surrogates. Add async/sync rendering regressions for mixed characters, empty inputs, and distinct characters sharing a surrogate.

Validation: build and lint pass; all 1,666 tests pass on Node 16, 20, and 24. Node 22 coverage and demo checks pass.

@harttle
harttle merged commit 3fe244f into harttle:master Sep 20, 2026
14 checks passed
@harttle harttle added the bug label Sep 20, 2026
@harttle

harttle commented Sep 20, 2026

Copy link
Copy Markdown
Owner

@all-contributors please add @jakezwang for code.

@allcontributors

Copy link
Copy Markdown
Contributor

@harttle

I've put up a pull request to add @jakezwang! 🎉

github-actions Bot pushed a commit that referenced this pull request Oct 1, 2026
# [10.30.0](v10.29.0...v10.30.0) (2026-10-01)

### Bug Fixes

* **base64_encode:** encode large input in browser builds ([#969](#969)) ([8aace78](8aace78)), closes [#967](#967)
* **date:** compute %C and %y from the numeric year ([#961](#961)) ([e68514f](e68514f))
* **date:** compute %U and %W week numbers like strftime ([#958](#958)) ([0587ca8](0587ca8))
* trim custom characters by Unicode code point ([#955](#955)) ([3fe244f](3fe244f))
* **truncatewords:** ignore leading whitespace when counting words ([#954](#954)) ([65e200e](65e200e))
* **url_decode:** keep %2B as a literal plus when decoding ([#939](#939)) ([9af92f5](9af92f5))

### Features

* await promises returned by Drop.valueOf() ([#948](#948)) ([#953](#953)) ([#959](#959)) ([7dfa76b](7dfa76b))
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 10.30.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants