6 ms·
Also, for doing `substr()` to limit the length of a title, for example. I'm still struggling with this in one place, where, for some reason, Cyrillic character
by forgotmypw17 5y ago
Also, for doing `substr()` to limit the length of a title, for example.
I'm still struggling with this in one place, where, for some reason, Cyrillic characters get cut in half.
- AndriyKunitsyn 5y agoIf your substr() cuts characters in half, then the reason is simple - it's either not aware of multi-byte encodings, so it cuts by bytes instead of cutting by characters, or the encoding it uses is different from the encoding of your string, so substr() cuts it wrong. You may visualize all that by converting your strings to lists of bytes.
- kaetemi 5y agoThat's the point. You can lose accents, or other parts of a character, even if you are aware of the encoding. You need to be aware of the modifiers as well.