Rev 55 | Rev 63 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 55 | Rev 56 | ||
---|---|---|---|
Line 106... | Line 106... | ||
106 | if ($res === false) $res = iconv('UTF-8', 'UTF-8//IGNORE', $text); |
106 | if ($res === false) $res = iconv('UTF-8', 'UTF-8//IGNORE', $text); |
107 | 107 | ||
108 | return $res; |
108 | return $res; |
109 | } |
109 | } |
110 | 110 | ||
- | 111 | function vts_utf8_decode($text) { |
|
- | 112 | $enc = mb_detect_encoding($text, null, true); |
|
- | 113 | if ($enc === false) $enc = mb_detect_encoding($text, ['ASCII', 'UTF-8', 'Windows-1252', 'ISO-8859-1'], true); |
|
- | 114 | if ($enc === false) $enc = null; |
|
- | 115 | ||
- | 116 | if ($enc !== 'UTF-8') return $text; |
|
- | 117 | ||
- | 118 | $res = mb_convert_encoding($text, 'Windows-1252', $enc); |
|
- | 119 | if ($res === false) $res = iconv('Windows-1252', 'Windows-1252//IGNORE', $text); |
|
- | 120 | ||
- | 121 | return $res; |
|
- | 122 | } |
|
- | 123 | ||
111 | function stripHtmlComments($html) { |
124 | function stripHtmlComments($html) { |
112 | // https://stackoverflow.com/questions/11337332/how-to-remove-html-comments-in-php |
125 | // https://stackoverflow.com/questions/11337332/how-to-remove-html-comments-in-php |
113 | $html = preg_replace("~<!--(?!<!)[^\[>].*?-->~s", "", $html); |
126 | $html = preg_replace("~<!--(?!<!)[^\[>].*?-->~s", "", $html); |
114 | return $html; |
127 | return $html; |
115 | } |
128 | } |