isUtf8 example


    protected function toUtf8($string)
    {
        if ($this->getEncoding() === 'utf-8') {
            $result = $string;
        } else {
            $result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding());
        }

        if ($this->isUtf8($result)) {
            throw new Exception\RuntimeException(
                sprintf('String to be escaped was not valid UTF-8 or could not be converted: %s', $result)
            );
        }

        return $result;
    }

    /** * Converts a string from UTF-8 to the base encoding. The base encoding is set via this * * @param string $string * @return string */
Home | Imprint | This part of the site doesn't use cookies.