1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
<?php namespace PicoFeed\Encoding; /** * Encoding class * * @package Encoding */ class Encoding { public static function convert($input, $encoding) { if ($encoding === 'utf-8' || $encoding === '') { return $input; } // convert input to utf-8; ignore malformed characters return iconv($encoding, 'UTF-8//IGNORE', $input); } }