classes/phing/filters/EscapeUnicode.php
public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->initialize();
            $this->setInitialized(true);
        }

        // Process whole text at once.
        $text = null;
        while (($data = $this->in->read($len)) !== -1) {
            $text .= $data;
        }

        // At the end.
        if (null === $text) {
            return -1;
        }

        $textArray = preg_split("~\R~", $text);

        $lines = [];
        foreach ($textArray as $offset => $line) {
            $lines[] = trim(json_encode($line), '"');
            if (strlen($line) !== strlen($lines[$offset])) {
                $this->log(
                    "Escape unicode chars on line " . ($offset + 1)
                    . " from " . $line . " to " . $lines[$offset],
                    Project::MSG_VERBOSE
                );
            }
        }

        $escaped = implode(PHP_EOL, $lines);

        return $escaped;
    }
public function read($len = null)
    {
        if (!$this->getInitialized()) {
            $this->initialize();
            $this->setInitialized(true);
        }

        // Process whole text at once.
        $text = null;
        while (($data = $this->in->read($len)) !== -1) {
            $text .= $data;
        }

        // At the end.
        if (null === $text) {
            return -1;
        }

        $textArray = preg_split("~\R~", $text);

        $lines = [];
        foreach ($textArray as $offset => $line) {
            $lines[] = trim(json_encode($line), '"');
            if (strlen($line) !== strlen($lines[$offset])) {
                $this->log(
                    "Escape unicode chars on line " . ($offset + 1)
                    . " from " . $line . " to " . $lines[$offset],
                    Project::MSG_VERBOSE
                );
            }
        }

        $escaped = implode(PHP_EOL, $lines);

        return $escaped;
    }
public function read ( $ len = null ) { if ( ! $ this -> getInitialized ( ) ) { $ this -> initialize ( ) ; $ this -> setInitialized ( true ) ; } // Process whole text at once. $ text = null ; while ( ( $ data = $ this -> in -> read ( $ len ) ) !== - 1 ) { $ text .= $ data ; } // At the end. if ( null === $ text ) { return - 1 ; } $ textArray = preg_split ( "~\R~" , $ text ) ; $ lines = [ ] ; foreach ( $ textArray as $ offset => $ line ) { $ lines [ ] = trim ( json_encode ( $ line ) , '"' ) ; if ( strlen ( $ line ) !== strlen ( $ lines [ $ offset ] ) ) { $ this -> log ( "Escape unicode chars on line " . ( $ offset + 1 ) . " from " . $ line . " to " . $ lines [ $ offset ] , Project :: MSG_VERBOSE ) ; } } $ escaped = implode ( PHP_EOL , $ lines ) ; return $ escaped ; }
Returns the next line in the filtered stream, converting non latin
characters to unicode escapes.

@param  int $len optional
@return string      the converted lines in the resulting stream, or -1
if the end of the resulting stream has been reached
@throws IOException if the underlying stream throws
an IOException during reading
Returns the next line in the filtered stream converting non latin characters to unicode escapes .