Folks,

Why should htmlentities() use the default_charset for $charset with this
example, taken from ext/standard/tests/strings/htmlentities10.phpt?

<?php
        ini_set('mbstring.internal_encoding','pass');
        ini_set('default_charset','cp1252');
        var_dump(htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, ''));
?>

The test script expects the output to be:
string(28) "&sbquo;&dagger;&trade;&Yuml;"

According to the PHP Manual, the htmlentities() syntax is:

string htmlentities  ( string $string  [, int $quote_style  [, string
$charset  [, bool $double_encode  ]]] )

For the parameter charset:

"Like htmlspecialchars(), it takes an optional third argument charset which
defines character set used in conversion. Presently, the ISO-8859-1
character set is used as the default."  It goes on to list the supported
values for charset and states:  "Note:  Any other character sets are not
recognized and ISO-8859-1 will be used instead."

Therefore, when $charset = '' I would expect that
htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '') would use ISO-8859-1 since
the null string is not listed as a supported value.  Also, it does not
mention the use of default_charset.  Furthermore, when default_charset = '',
PHP states that ISO-8859-1 will be used as the default.

Since the $charset is optional, I would expect
htmlentities("\x82\x86\x99\x9f", ENT_QUOTES) would use the default_charset,
but not htmlentities("\x82\x86\x99\x9f", ENT_QUOTES, '').  However, test
scripts ext/standard/tests/strings/htmlentities10.phpt, htmlentities11.phpt,
and htmlentities13.phpt all expect the default_charset to be used when
charset=''.

Thanks.

Jim
-----
Jim Hermann <[EMAIL PROTECTED]>
UUism Networks <http://www.UUism.net>
Ministering to the Needs of Online UUs
Web Hosting, Email Services, Mailing Lists
-----


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to