Skip to content
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

String replacement in snippets is wrong for strings with multibyte characters #723

Closed
bobdenotter opened this issue Nov 16, 2019 · 1 comment · Fixed by bolt/common#24
Milestone

Comments

@bobdenotter
Copy link
Member

@bobdenotter bobdenotter commented Nov 16, 2019

As reported by Erik W. on Slack:

I came across an odd issue. I'm getting <meta name="generator" content="Bolt"></head>d> in my markup. It was caused by the fact I was using one of those curved quotation marks in my title (http://www.fileformat.info/info/unicode/char/2019/index.htm) which is made up of three bytes. In Str.replaceLast , mb_strrpos() is counting it as 1, but substr_replace() counts it as 3, causing the replace to leave that leftover d>. There isn't a multibyte substr_replace though?

To remedy this, we should:

  • Add a multibyte string replace method to bolt/common
  • Use that in Str::replaceLast, Str::replaceFirst and perhaps others.

See also:

@bobdenotter

This comment has been minimized.

Copy link
Member Author

@bobdenotter bobdenotter commented Nov 18, 2019

Fixed in bolt/common#24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.