开发者

PHP iconv_strlen function display problem

In the code below I'm trying to get the bytes for the character which should be 3 for the first function but I keep getting the value of 1 for each 开发者_运维技巧iconv_strlen function below. How can I figure out why this is?

Here is the code:

echo iconv_strlen("こ") . '<br />';
echo iconv_strlen("こ", "UTF-8") . '<br />';


Correct value in first case is 1, not 3.
If you want to get count of bytes, you can use strlen() function, or change iconv.internal_encoding directive in php.ini or by ini_set() (to ISO-8859-1) - but it will affect all iconv-functions, so I recommend to use strlen().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜