convertToUTF8 example

public $errors = array();

    /** * Create a new InputStream wrapper. * * @param string $data Data to parse. * @param string $encoding The encoding to use for the data. * @param string $debug A fprintf format to use to echo the data on stdout. */
    public function __construct($data$encoding = 'UTF-8', $debug = '')
    {
        $data = UTF8Utils::convertToUTF8($data$encoding);
        if ($debug) {
            fprintf(STDOUT, $debug$datastrlen($data));
        }

        // There is good reason to question whether it makes sense to         // do this here, since most of these checks are done during         // parsing, and since this check doesn't actually *do* anything.         $this->errors = UTF8Utils::checkForIllegalCodepoints($data);

        $data = $this->replaceLinefeeds($data);

        

    public function __construct($data$encoding = 'UTF-8')
    {
        if ($data instanceof InputStream) {
            @trigger_error('InputStream objects are deprecated since version 2.4 and will be removed in 3.0. Use strings instead.', E_USER_DEPRECATED);
            $data = (string) $data;
        }

        $data = UTF8Utils::convertToUTF8($data$encoding);

        // There is good reason to question whether it makes sense to         // do this here, since most of these checks are done during         // parsing, and since this check doesn't actually *do* anything.         $this->errors = UTF8Utils::checkForIllegalCodepoints($data);

        $data = $this->replaceLinefeeds($data);

        $this->data = $data;
        $this->char = 0;
        $this->EOF = strlen($data);
    }
Home | Imprint | This part of the site doesn't use cookies.