PHP mb_substr() not working correctly?

前端 未结 2 2051
野趣味
野趣味 2021-02-12 12:11

This code

print mb_substr(\'éxxx\', 0, 1);

prints an empty space :(

It is supposed to print the first character, é. This seems

2条回答
  •  时光取名叫无心
    2021-02-12 12:55

    In practice I've found that, in some systems, multi-byte functions default to ISO-8859-1 for internal encoding. That effectively ruins their ability to handle multi-byte text.

    Setting a good default will probably fix this and some other issues:

    mb_internal_encoding('UTF-8');
    

提交回复
热议问题