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
[EMAIL PROTECTED]


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to