<?php  if (!defined('BASEPATH')) { exit('No direct script access allowed'); }
/**
 * CodeIgniter helper
 *
 * @category CodeIgniter
 * @license /_licenses/untermStrich/agb_normal.pdf
 * @author Christian Koller
 * @copyright 2009 untermStrich
 * @package helpers
 * @version $Id$
 */

if ( ! function_exists('us_utf8_decode')) {

    /**
     * utf8_decode replacement
     *
     * @param string|null $utf8_string
     * @return array|false|string
     */
    function us_utf8_decode(?string $utf8_string)
    {
        return mb_convert_encoding($utf8_string ?? '', 'ISO-8859-1', 'UTF-8');
    }
}


if ( ! function_exists('us_utf8_encode')) {

    /**
     * utf8_encode replacement
     *
     * @param string|null $iso8859_1_string
     * @return array|false|string
     */
    function us_utf8_encode(?string $iso8859_1_string)
    {
        return mb_convert_encoding($iso8859_1_string ?? '', 'UTF-8', 'ISO-8859-1');
    }
}
