8000 Handle unicode characters on TrimStrings middleware by rodrigopedra · Pull Request #40596 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

Handle unicode characters on TrimStrings middleware #40596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed

Handle unicode characters on TrimStrings middleware #40596

wants to merge 10 commits into from

Conversation

rodrigopedra
Copy link
Contributor
@rodrigopedra rodrigopedra commented Jan 25, 2022

PR #38117 introduced the ability to other space unicode characters to the TrimStrings middleware.

As issue #40577 stated the current implementation conflicts with some other unicode characters which end with the same escape sequence as the NBSP character.

In particular these japanese characters:

  • だ (unicode E381A0)
  • ム (unicode E383A0)

The implementation from PR #38117 causes the A0 sequence to be trimmed, which converts the sequence to an invalid one.

This PR:

  • Changes the implementation to use preg_replace to trim the spaces using the proper modifiers
  • Add additional test cases that failed with the previous implementation and passed with the proposed one

Closes #40577

@rodrigopedra
Copy link
Contributor Author

sending to 9.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0