diff options
| author | Markus Birth <github.com@birth-online.de> | 2013-11-22 00:38:21 -0800 |
|---|---|---|
| committer | Markus Birth <github.com@birth-online.de> | 2013-11-22 00:38:21 -0800 |
| commit | 1c2ad7105a2fb2a446a122d8daa2048aa0f5bbbb (patch) | |
| tree | 1ebd7757053514b293c209062acb57cd97c5eff8 | |
| parent | 7358ed837915daf7556fc172dd2a97f0d1a652f1 (diff) | |
| parent | 128aa0e7c249421db33bea506f245f1f4f0a52d8 (diff) | |
| download | yafpp-1c2ad7105a2fb2a446a122d8daa2048aa0f5bbbb.tar.gz yafpp-1c2ad7105a2fb2a446a122d8daa2048aa0f5bbbb.zip | |
Merge pull request #15 from Alarik/master
Add option to force convert linked page to unicode
| -rw-r--r-- | init.php | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -90,21 +90,30 @@ class Af_Feedmod extends Plugin implements IHandler } } } - + + $charset = false; if (!isset($config['force_charset'])) { - $charset = false; if ($content_type) { preg_match('/charset=(\S+)/', $content_type, $matches); if (isset($matches[1]) && !empty($matches[1])) $charset = $matches[1]; } - - if ($charset) { - $html = '<?xml encoding="' . $charset . '">' . $html; - } } else { // use forced charset - $html = '<?xml encoding="' . $config['force_charset'] . '">' . $html; + $charset = $config['force_charset']; + } + + if ($charset && isset($config['force_unicode']) && $config['force_unicode']) { + $html = iconv($charset, 'utf-8', $html); + $charset = 'utf-8'; + } + + if ($charset) { + $html = '<?xml encoding="' . $charset . '">' . $html; } + + + + @$doc->loadHTML($html); |
