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
2 tasks
bobdenotter opened this issue Nov 16, 2019 · 1 comment · Fixed by bolt/common#24
Closed
2 tasks
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:

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 a pull request may close this issue.

1 participant