From: Reini U. <ru...@x-...> - 2006-08-15 12:43:55
|
Reini Urban schrieb: >> 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. Ok, this works: lib/IniConfig.php: function _unknown_charset_warning($error) { if (preg_match('/^charset \`.+\' not supported, assuming iso-8859-1/', $error->errstr)) return true; // Ignore error return false; } and inside fixup_static_configs() after $charset = CHARSET; if (defined('IGNORE_CHARSET_NOT_SUPPORTED_WARNING') and IGNORE_CHARSET_NOT_SUPPORTED_WARNING) { global $ErrorManager; $ErrorManager->pushErrorHandler(new WikiFunctionCb('_unknown_charset_warning')); } Now put in config.ini for all charsets not listed below the lines: ; Most exotic charsets are not supported by htmlspecialchars, which prints a warning: ; "charset `bla' not supported, assuming iso-8859-1" ; Even on simple 8bit charsets, where just <>& need to be replaced. ; See <php-src>/ext/standard/html.c ; We can ignore these warnings then. IGNORE_CHARSET_NOT_SUPPORTED_WARNING = true > 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 }, |