summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/lib/PicoFeed/Encoding/Encoding.php
blob: 0590c47b1b44b4bb3b69c9fb3fa139f93ce21e32 (plain)
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);
    }
}