static public function getCsv( $handle, $length = null, $delimiter = ',', $enclosure = '"' )
    {
        $separator = preg_quote( $delimiter );
        $quoteSymbol = preg_quote( $enclosure );

        $line = '';
        $eof = false;
        do {
            $line .= ( $length === null ? fgets( $handle ) : fgets( $handle, (int) $length ) );
            $eof = ( preg_match_all( '/' . $quoteSymbol . '/', $line ) % 2 == 0 );
        }
        while ( !$eof );
        if ( empty( $line ) ) {
            return false;
        }

        $csvPattern = '/(' . $quoteSymbol . '[^' . $quoteSymbol . ']*(?:' . $quoteSymbol . $quoteSymbol . '[^' . $quoteSymbol . ']*)*' . $quoteSymbol . '|[^' . $separator . ']*)' . $separator . '/';
        $csvLine = preg_replace( '/(?: |[ ])?$/', $separator, trim( $line ) );
        $matches = null;
        preg_match_all( $csvPattern, $csvLine, $matches );
        $row = $matches[1];
        for ( $col = 0; $col < count( $row ); $col++ ) {
            $row[$col] = preg_replace( '/^' . $quoteSymbol . '(.*)' . $quoteSymbol . '$/s', '$1', $row[$col] );
            $row[$col] = str_replace( $quoteSymbol . $quoteSymbol, $quoteSymbol, $row[$col] );
        }
        return $row;
    }
static public function getCsv( $handle, $length = null, $delimiter = ',', $enclosure = '"' )
    {
        $separator = preg_quote( $delimiter );
        $quoteSymbol = preg_quote( $enclosure );

        $line = '';
        $eof = false;
        do {
            $line .= ( $length === null ? fgets( $handle ) : fgets( $handle, (int) $length ) );
            $eof = ( preg_match_all( '/' . $quoteSymbol . '/', $line ) % 2 == 0 );
        }
        while ( !$eof );
        if ( empty( $line ) ) {
            return false;
        }

        $csvPattern = '/(' . $quoteSymbol . '[^' . $quoteSymbol . ']*(?:' . $quoteSymbol . $quoteSymbol . '[^' . $quoteSymbol . ']*)*' . $quoteSymbol . '|[^' . $separator . ']*)' . $separator . '/';
        $csvLine = preg_replace( '/(?: |[ ])?$/', $separator, trim( $line ) );
        $matches = null;
        preg_match_all( $csvPattern, $csvLine, $matches );
        $row = $matches[1];
        for ( $col = 0; $col < count( $row ); $col++ ) {
            $row[$col] = preg_replace( '/^' . $quoteSymbol . '(.*)' . $quoteSymbol . '$/s', '$1', $row[$col] );
            $row[$col] = str_replace( $quoteSymbol . $quoteSymbol, $quoteSymbol, $row[$col] );
        }
        return $row;
    }
static public function getCsv ( $ handle , $ length = null , $ delimiter = ',' , $ enclosure = '"' ) { $ separator = preg_quote ( $ delimiter ) ; $ quoteSymbol = preg_quote ( $ enclosure ) ; $ line = '' ; $ eof = false ; do { $ line .= ( $ length === null ? fgets ( $ handle ) : fgets ( $ handle , ( int ) $ length ) ) ; $ eof = ( preg_match_all ( '/' . $ quoteSymbol . '/' , $ line ) % 2 == 0 ) ; } while ( ! $ eof ) ; if ( empty ( $ line ) ) { return false ; } $ csvPattern = '/(' . $ quoteSymbol . '[^' . $ quoteSymbol . ']*(?:' . $ quoteSymbol . $ quoteSymbol . '[^' . $ quoteSymbol . ']*)*' . $ quoteSymbol . '|[^' . $ separator . ']*)' . $ separator . '/' ; $ csvLine = preg_replace ( '/(?: |[ ])?$/' , $ separator , trim ( $ line ) ) ; $ matches = null ; preg_match_all ( $ csvPattern , $ csvLine , $ matches ) ; $ row = $ matches [ 1 ] ; for ( $ col = 0 ; $ col < count ( $ row ) ; $ col ++ ) { $ row [ $ col ] = preg_replace ( '/^' . $ quoteSymbol . '(.*)' . $ quoteSymbol . '$/s' , '$1' , $ row [ $ col ] ) ; $ row [ $ col ] = str_replace ( $ quoteSymbol . $ quoteSymbol , $ quoteSymbol , $ row [ $ col ] ) ; } return $ row ; }
Customized a method to read CSV file with Chinese content,
instead of using PHP fgetcsv function.

@param resource $handle
@param int $length
@param string $delimiter
@param string $enclosure
@return string[]
Customized a method to read CSV file with Chinese content instead of using PHP fgetcsv function .