Re:PHP 8
by electrotype on Thursday November 26, 2020 @01:10PM
(#25222265)
I think I had issues even with mbstring, for some characters like "œ". But maybe I'm wrong.
[ Parent
| on HN ]
œ works fine with mb_strlen(). What might have been tripping you up is combining character sequences:
Handling those "correctly" with a string length function gets complicated in any language, as there isn't a 1-to-1 mapping between Unicode codepoints and visible glyphs.
In PHP grapheme_strlen achieves what you're describing: https://3v4l.org/HPOb3
Re:PHP 8
by electrotype on Thursday November 26, 2020 @01:55PM
(#25222657)
Yes, I think you nailed what my issue was.