public function setEncoding($direction, $encoding)
    {
        if (!isset($this->encoding[$direction])) {
            throw new Exception("Encoding direction invalid");
        }

        if (!$encoding) {
            throw new Exception("Encoding value invalid");
        } elseif (preg_match('/utf.?8/ui', $encoding)) {
            $encoding = 'UTF-8';
        } else {
            $encoding = mb_strtoupper($encoding);
        }

        $this->encoding[$direction] = $encoding;

        return $this;
    }
public function setEncoding($direction, $encoding)
    {
        if (!isset($this->encoding[$direction])) {
            throw new Exception("Encoding direction invalid");
        }

        if (!$encoding) {
            throw new Exception("Encoding value invalid");
        } elseif (preg_match('/utf.?8/ui', $encoding)) {
            $encoding = 'UTF-8';
        } else {
            $encoding = mb_strtoupper($encoding);
        }

        $this->encoding[$direction] = $encoding;

        return $this;
    }
public function setEncoding ( $ direction , $ encoding ) { if ( ! isset ( $ this -> encoding [ $ direction ] ) ) { throw new Exception ( "Encoding direction invalid" ) ; } if ( ! $ encoding ) { throw new Exception ( "Encoding value invalid" ) ; } elseif ( preg_match ( '/utf.?8/ui' , $ encoding ) ) { $ encoding = 'UTF-8' ; } else { $ encoding = mb_strtoupper ( $ encoding ) ; } $ this -> encoding [ $ direction ] = $ encoding ; return $ this ; }
Set encoding for CSV.

@param string $direction
@param string $encoding

@return $this
@throws Exception
Set encoding for CSV .