From: Reini U. <ru...@x-...> - 2006-08-15 12:18:22
|
Reini Urban schrieb: > Mici Maci schrieb: >> Hi, >>> of course we accept any workaround function. >> You're welcome to rename it! :) >> <?php function htmlspecialchars_workaround($str, $quote = > > Ok. Now how to handle this best? > We need this only on certain charsets, which php upstream doesn't > support, because they prefer utf-8. > And we need it only for htmlspecialchars. > > rurban@reini /usr/src/php/phpwiki-dev/phpwiki > $ grep -Rl htmlspecialchars . > ./configurator.php > ./lib/nusoap/nusoap.php > ./lib/plugin/TexToPng.php > ./lib/WikiDB/adodb/adodb-lib.inc.php > ./lib/WikiDB/adodb/adodb.inc.php > ./lib/WikiDB/adodb/drivers/adodb-csv.inc.php > ./lib/WikiDB/backend/file.php > ./lib/WikiDB/backend/flatfile.php > ./lib/WikiPluginCached.php > ./lib/XmlElement.php > ./lib/XMLRPC/xmlrpc.inc > ./lib/XmlRpcServer.php > > rurban@reini /usr/src/php/phpwiki-dev/phpwiki > $ grep -Rl htmlentities . > ./configurator.php > ./doc/README.foaf > ./lib/HttpClient.php > ./lib/pear/DB/storage.php > ./lib/plugin/ModeratedPage.php > ./lib/plugin/WikiFormRich.php > ./lib/XMLRPC/xmlrpc.inc > ./passencrypt.php > ./themes/default/templates/login.tmpl > ./themes/default/templates/online.tmpl > > So we have some external libs also. > > We also could simply catch the warning and omit it. > It's only the stupid warning, isn't it, or is there functionality > missing also? And there're a lot of unsupported charsets. I've just looked into the php source and found that this warning can be safely ignored by our error hook as already done somewhere else. This is much easier than replacing all the htmlspecialchars occurences. Most exotic charsets are not supported by htmlspecialchars, which just prints a E_WARNING. Even on simple 8bit charsets, where just <>& need to be replaced. See <php-src>/ext/standard/html.c Supported charsets are: { "ISO-8859-1", cs_8859_1 }, { "ISO8859-1", cs_8859_1 }, { "ISO-8859-15", cs_8859_15 }, { "ISO8859-15", cs_8859_15 }, { "utf-8", cs_utf_8 }, { "cp1252", cs_cp1252 }, { "Windows-1252", cs_cp1252 }, { "1252", cs_cp1252 }, { "BIG5", cs_big5 }, { "950", cs_big5 }, { "GB2312", cs_gb2312 }, { "936", cs_gb2312 }, { "BIG5-HKSCS", cs_big5hkscs }, { "Shift_JIS", cs_sjis }, { "SJIS", cs_sjis }, { "932", cs_sjis }, { "EUCJP", cs_eucjp }, { "EUC-JP", cs_eucjp }, { "KOI8-R", cs_koi8r }, { "koi8-ru", cs_koi8r }, { "koi8r", cs_koi8r }, { "cp1251", cs_cp1251 }, { "Windows-1251", cs_cp1251 }, { "win-1251", cs_cp1251 }, { "iso8859-5", cs_8859_5 }, { "iso-8859-5", cs_8859_5 }, { "cp866", cs_cp866 }, { "866", cs_cp866 }, { "ibm866", cs_cp866 }, /* now walk the charset map and look for the codeset */ ... if (!found) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "charset `%s' not supported, assuming iso-8859-1", charset_hint); } -- Reini Urban http://phpwiki.org/ http://murbreak.at/ http://helsinki.at/ http://spacemovie.mur.at/ |