diff options
-rwxr-xr-x | examples/download.php | 2 | ||||
-rwxr-xr-x | examples/extract.php | 4 | ||||
-rwxr-xr-x | examples/filtering.php | 4 | ||||
-rwxr-xr-x | examples/json.php | 2 | ||||
-rwxr-xr-x | examples/table.php | 4 | ||||
-rwxr-xr-x | examples/writing.php | 4 | ||||
-rwxr-xr-x | examples/xml.php | 2 | ||||
-rw-r--r-- | src/Config/Controls.php | 10 |
8 files changed, 18 insertions, 14 deletions
diff --git a/examples/download.php b/examples/download.php index 1a769e6..233d4f5 100755 --- a/examples/download.php +++ b/examples/download.php @@ -5,5 +5,5 @@ use League\Csv\Reader; require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); -$inputCsv->setEncoding('ISO-8859-15'); +$inputCsv->setEncodingFrom('ISO-8859-15'); $inputCsv->output('firstname.csv'); //specifying a filename triggers header sending diff --git a/examples/extract.php b/examples/extract.php index 165af6d..a33c985 100755 --- a/examples/extract.php +++ b/examples/extract.php @@ -9,7 +9,7 @@ require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); $inputCsv->setDelimiter(';'); -$inputCsv->setEncoding("iso-8859-15"); +$inputCsv->setEncodingFrom("iso-8859-15"); //get the header $headers = $inputCsv->fetchOne(0); @@ -20,7 +20,7 @@ $res = $inputCsv->setOffset(800)->setLimit(25)->fetchAll(); <!doctype html> <html lang="fr"> <head> - <meta charset="<?=$inputCsv->getEncoding()?>"> + <meta charset="<?=$inputCsv->getEncodingFrom()?>"> <title>\League\Csv\Reader simple usage</title> <link rel="stylesheet" href="example.css"> </head> diff --git a/examples/filtering.php b/examples/filtering.php index 15d2127..ee4140c 100755 --- a/examples/filtering.php +++ b/examples/filtering.php @@ -10,7 +10,7 @@ require '../vendor/autoload.php'; //you can instantiate the Reader class with a SplFileObject object $inputCsv = Reader::createFromPath(new SplFileObject('data/prenoms.csv')); $inputCsv->setDelimiter(';'); -$inputCsv->setEncoding("iso-8859-15"); +$inputCsv->setEncodingFrom("iso-8859-15"); $res = $inputCsv ->addFilter(function ($row, $index) { @@ -40,7 +40,7 @@ $headers = $inputCsv->fetchOne(0); <!doctype html> <html lang="fr"> <head> - <meta charset="<?=$inputCsv->getEncoding()?>"> + <meta charset="<?=$inputCsv->getEncodingFrom()?>"> <title>\League\Csv\Reader filtering method</title> <link rel="stylesheet" href="example.css"> </head> diff --git a/examples/json.php b/examples/json.php index f1bf3e9..06293a6 100755 --- a/examples/json.php +++ b/examples/json.php @@ -9,7 +9,7 @@ require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); $inputCsv->setDelimiter(';'); -$inputCsv->setEncoding('ISO-8859-15'); +$inputCsv->setEncodingFrom('ISO-8859-15'); $inputCsv->setFlags(SplFileObject::DROP_NEW_LINE|SplFileObject::READ_AHEAD|SplFileObject::SKIP_EMPTY); $res = json_encode($inputCsv, JSON_PRETTY_PRINT|JSON_HEX_QUOT|JSON_HEX_TAG|JSON_HEX_AMP|JSON_HEX_APOS); if (JSON_ERROR_NONE != json_last_error()) { diff --git a/examples/table.php b/examples/table.php index 1c5ab4d..5dbda3e 100755 --- a/examples/table.php +++ b/examples/table.php @@ -9,12 +9,12 @@ require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); $inputCsv->setDelimiter(';'); -$inputCsv->setEncoding("iso-8859-15"); +$inputCsv->setEncodingFrom("iso-8859-15"); ?> <!doctype html> <html lang="fr"> <head> - <meta charset="<?=$inputCsv->getEncoding()?>"> + <meta charset="<?=$inputCsv->getEncodingFrom()?>"> <title>Using the toHTML() method</title> <link rel="stylesheet" href="example.css"> </head> diff --git a/examples/writing.php b/examples/writing.php index 30fb80d..5be7716 100755 --- a/examples/writing.php +++ b/examples/writing.php @@ -9,7 +9,7 @@ require '../vendor/autoload.php'; $writer = Writer::createFromFileObject(new SplTempFileObject); //the CSV file will be created into a temporary File $writer->setDelimiter("\t"); //the delimiter will be the tab character -$writer->setEncoding("utf-8"); +$writer->setEncodingFrom("utf-8"); $headers = ["position" , "team", "played", "goals difference", "points"]; $writer->insertOne($headers); @@ -29,7 +29,7 @@ $writer->insertAll($teams); <!doctype html> <html lang="fr"> <head> - <meta charset="<?=$writer->getEncoding()?>"> + <meta charset="<?=$writer->getEncodingFrom()?>"> <title>Using the \League\Writer object</title> <link rel="stylesheet" href="example.css"> </head> diff --git a/examples/xml.php b/examples/xml.php index a55ba3f..8db4c7c 100755 --- a/examples/xml.php +++ b/examples/xml.php @@ -8,7 +8,7 @@ use League\Csv\Reader; require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); -$inputCsv->setEncoding('ISO-8859-15'); +$inputCsv->setEncodingFrom('ISO-8859-15'); $inputCsv->setDelimiter(';'); $doc = $inputCsv->toXML('csv', 'ligne', 'cellule'); $xml = $doc->saveXML(); diff --git a/src/Config/Controls.php b/src/Config/Controls.php index 963851d..d92bb2f 100644 --- a/src/Config/Controls.php +++ b/src/Config/Controls.php @@ -177,11 +177,13 @@ trait Controls } /** - * Set the CSV encoding charset + * DEPRECATION WARNING! This method will be removed in the next major point release + * + * @deprecated deprecated since version 5.5 * * @param string $str * - * @return self + * @return static The invoked object */ public function setEncoding($str) { @@ -189,7 +191,9 @@ trait Controls } /** - * Get the CSV encoding charset + * DEPRECATION WARNING! This method will be removed in the next major point release + * + * @deprecated deprecated since version 5.5 * * @return string */ |