15 if (! defined(
'ENT_SUBSTITUTE')) {
16 define(
'ENT_SUBSTITUTE', 0);
27 if (strlen($content) == 0) {
34 if (! $output1 || !
checkUTF8($output1)) {
35 $output1 = $toHTML ?
"<Unknown encoding>" :
"<b>Unknown encoding</b>";
42 return (htmlspecialchars($output1, ENT_SUBSTITUTE,
"UTF-8")) ?:
"<b>Unknown encoding</b>";
52 return mb_check_encoding($content,
"UTF-8");
62 $inCharset = mb_detect_encoding($content, mb_detect_order(),
true);
65 $charsets = array(
'iso-8859-1',
'windows-1251',
'GB2312');
66 foreach ($charsets as $charset) {
67 $output1 = iconv($charset,
"UTF-8", $content);
72 }
else if ($inCharset !=
"UTF-8") {
73 $output1 = iconv($inCharset,
"UTF-8", $content);
tryConvertToUTF8($content)
if(! defined('ENT_SUBSTITUTE')) convertToUTF8($content, $toHTML=true)