diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-07-13 17:44:44 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-07-13 17:44:44 +0200 |
commit | 17f2cf72af4173409ee294a204de4221b0275428 (patch) | |
tree | 366d2621adfe0c4b862d0afba607076c5d3e30e0 /vendor/fguillot/picofeed/lib/PicoFeed/Encoding | |
parent | 5ee4dcd035cbf8c00ff95f02fce6ff6b3dc61aaf (diff) |
update picofeed
Diffstat (limited to 'vendor/fguillot/picofeed/lib/PicoFeed/Encoding')
-rw-r--r-- | vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php b/vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php index 0590c47b1..5821dd40c 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php @@ -15,7 +15,21 @@ class Encoding return $input; } - // convert input to utf-8; ignore malformed characters - return iconv($encoding, 'UTF-8//IGNORE', $input); + // suppress all notices since it isn't possible to silence only the + // notice "Wrong charset, conversion from $in_encoding to $out_encoding is not allowed" + set_error_handler(function() {}, E_NOTICE); + + // convert input to utf-8 and strip invalid characters + $value = iconv($encoding, 'UTF-8//IGNORE', $input); + + // stop silencing of notices + restore_error_handler(); + + // return input if something went wrong, maybe it's usable anyway + if ($value === false) { + return $input; + } + + return $value; } } |