\League\CsvCharsetConverter

Converts resource stream or tabular data content charset.

Summary

Methods
Properties
Constants
addTo()
register()
getFiltername()
onCreate()
filter()
convert()
__invoke()
inputEncoding()
outputEncoding()
$filtername
$params
FILTERNAME
filterEncoding()
encodeField()
$input_encoding
$output_encoding
N/A
No private methods found
No private properties found
N/A

Constants

FILTERNAME

FILTERNAME = 'convert.league.csv'

Properties

$filtername

$filtername : string

the filter name used to instantiate the class with.

Type

string

$params

$params : mixed

Contents of the params parameter passed to stream_filter_append or stream_filter_prepend functions.

Type

mixed

$input_encoding

$input_encoding : string

The records input encoding charset.

Type

string

$output_encoding

$output_encoding : string

The records output encoding charset.

Type

string

Methods

addTo()

addTo(\League\Csv\AbstractCsv  $csv, \League\Csv\string  $input_encoding, \League\Csv\string  $output_encoding) 

Static method to add the stream filter to a {@link AbstractCsv} object.

Parameters

\League\Csv\AbstractCsv $csv
\League\Csv\string $input_encoding
\League\Csv\string $output_encoding

register()

register() 

Static method to register the class as a stream filter.

getFiltername()

getFiltername(\League\Csv\string  $input_encoding, \League\Csv\string  $output_encoding) 

Static method to return the stream filter filtername.

Parameters

\League\Csv\string $input_encoding
\League\Csv\string $output_encoding

onCreate()

onCreate() 

{@inheritdoc}

filter()

filter(  $in,   $out,   $consumed,   $closing) 

{@inheritdoc}

Parameters

$in
$out
$consumed
$closing

convert()

convert(array|\Traversable  $records) : array|\Traversable

Convert Csv records collection into UTF-8.

Parameters

array|\Traversable $records

Returns

array|\Traversable

__invoke()

__invoke(array  $record) 

Enable using the class as a formatter for the {@link Writer}.

Parameters

array $record

inputEncoding()

inputEncoding(\League\Csv\string  $encoding) 

Sets the records input encoding charset.

Parameters

\League\Csv\string $encoding

outputEncoding()

outputEncoding(\League\Csv\string  $encoding) 

Sets the records output encoding charset.

Parameters

\League\Csv\string $encoding

filterEncoding()

filterEncoding(\League\Csv\string  $encoding) 

Filter encoding charset.

Parameters

\League\Csv\string $encoding

Throws

\OutOfRangeException

if the charset is malformed or unsupported

encodeField()

encodeField(mixed  $value, mixed  $offset) 

Walker method to convert the offset and the value of a CSV record field.

Parameters

mixed $value
mixed $offset