Re: mbstring module
| From: | Yasuo Ohgaki | Date: | Wed, 13 Mar 2002 00:49:02 +0000 |
| Subject: | Re: mbstring module | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-81111@lists.php.net to get a copy of this message | ||
Brad Lafountain wrote:
<? $str = "Hello World"; echo mb_strlen($str) . "\n"; echo mb_strlen(mb_convert_encoding($str, "BASE64"), "BASE64"); ?> the code above prints out 11 16 ... is this correct??? If so why does it work this way.Yes. This is correct. "BASE64" is not a valid _character_ encoding name and mb_strlen() treats it as default char encoding which will probably count a byte as a one char. <?php $str = "Hello World"; echo mb_strlen($str) . "\n"; echo "$str\n"; echo mb_strlen(mb_convert_encoding($str, "BASE64"), "BASE64")."\n"; echo mb_convert_encoding($str, "BASE64")."\n"; ?> 11 Hello World 16 SGVsbG8gV29ybGQ= -- Yasuo Ohgaki yohgaki@dd.iij4u.or.jp