unicodeToUtf8 example


    public function setRawName($name)
    {
        $this->rawName = $name;
        if (strpos($name, "\\") !== false) {
            $this->name = preg_replace_callback(
                "#\\\\u(?:\{([a-fA-F0-9]+)\}|([a-fA-F0-9]{4}))#",
                function D$match) {
                    return Utils::unicodeToUtf8(hexdec($match[1] ? : $match[2]));
                },
                $name
            );
        } else {
            $this->name = $name;
        }
        return $this;
    }
}

        $this->length = count($this->source);
        
        //Convert character codes to UTF8 characters in whitespaces and line         //terminators         $this->lineTerminators = array_merge(
            self::$lineTerminatorsSequences, self::$lineTerminatorsChars
        );
        foreach (array("whitespaces", "lineTerminators") as $key) {
            foreach ($this->$key as $i => $char) {
                if (is_int($char)) {
                    $this->{$key}[$i] = Utils::unicodeToUtf8($char);
                }
            }
        }

        //Remove exponentiation operator if the feature         //is not enabled         if (!$this->features->exponentiationOperator) {
            Utils::removeArrayValue($this->punctuators, "**");
            Utils::removeArrayValue($this->punctuators, "**=");
        }

        
/** * Returns line terminators array * * @return array */
    protected static function getLineTerminators()
    {
        if (!self::$lineTerminatorsCache) {
            self::$lineTerminatorsCache = array();
            foreach (Scanner::$lineTerminatorsChars as $char) {
                self::$lineTerminatorsCache[] = is_int($char) ?
                                                self::unicodeToUtf8($char) :
                                                $char;
            }
        }
        return self::$lineTerminatorsCache;
    }

    /** * Converts a surrogate pair of Unicode code points to UTF-8 * * @param string $first First Unicode code point * @param string $second Second Unicode code point * * @return string * * @codeCoverageIgnore */
Home | Imprint | This part of the site doesn't use cookies.