>> SquirrelMail scripts are designed to work with binary strings. They will >> have to deal with emails written in many different character sets. In >> some >> cases scripts must know string length in bytes and not in symbols. If >> PHP >> starts converting email body or message parts, strings won't match >> information stored in email headers. > > Try this, you'll see it's really easy: > <?php > //in Unicode mode all strings created this way are Unicode strings > $s = "<any unicode string>"; > var_dump(strlen(($s))); > var_dump(strlen((binary)$s)); > ?>
http://www.php.net/language.types.type-juggling#language.types.typecasting No (binary). PHP 4.1.2 = parse error in test2.php on line 5. PHP 5.2.0 = Parse error: syntax error, unexpected T_VARIABLE in test2.php on line 5 It is E_PARSE error, so I can't apply fix after detecting PHP6. Fix is not portable. We are talking about SquirrelMail code. Minimal PHP 4.1.x requirement. Good fix is closer to <?php //in Unicode mode all strings created this way are Unicode strings $s = "<any unicode string>"; var_dump(strlen($s)); // add php6 test here { settype($s,'binary'); // } var_dump(strlen($s)); ?> I will have to write wrappers for all affected functions. Not wise. strlen("\xC4\x85") = 2. strlen((binary)"\xC4\x85") = 4. Not good. It is one character in utf-8. Nevermind. Will watch how PHP6-dev changes and wait for better documentation. -- Tomas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php