Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing CSV from Windows UTF-8 return NULL #56

Closed
ghost opened this issue Nov 5, 2014 · 2 comments
Closed

Importing CSV from Windows UTF-8 return NULL #56

ghost opened this issue Nov 5, 2014 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Nov 5, 2014

When CSV file is an US standard, has only letters (Dec) code from c.a. 33 to 127 imports works fine.
Other Localisation, non english languages, letters like "óęłńśżźŻŹĆÓŁĘŚŃ" return all fields in one line empty (null), even if only ''strange'' letter exist. After removing that letter, work.

Code is simple:

if (move_uploaded_file($this->data['Payment']['file']['tmp_name'], $filename)) {
$csv = Reader::createFromPath($filename);
$headers = $csv->fetchOne(); -----> works on first line
echo debug($headers);
$data = $csv->setOffset(0)->setLimit(2)->fetchAll(); ----> not working
echo debug($data);
}

Source file is:
--------------------cut here-------------
2014-09-09;2014-09-09;PRZELEW ZEWNETRZNY PRZYCHODZACY;"OPLATA ZA KURS, MICHAL ";"ANDRZEJ JERZY UL. 11 LISTOPADA 08-110 SIEDLCE";'6575676646444666444545454545';200,00;250,67;
2014-09-09;2014-09-09;PRZELEW ZEWN TRZNY PRZYCHODZ•CY;"OP£ATA ZA KURS, JAKUB ";"ANDRZEJ JERZY UL. 11 LISTOPADA 08-110 SIEDLCE";'4435446435354657656575634534534534535';200,00;450,67;
-----------cut-here-------------

@nyamsprod
Copy link
Member

Assuming your are getting a CSV in a different locale as yours, you should first try to use the stream filtering capabilities as explained in the documentation and in the example.

You should also look at the FilterTranscode class as a example on how to transcode on the fly your CSV.
Hope it will help

@ghost
Copy link
Author

ghost commented Nov 5, 2014

Thank you!

Tomasz Kalinowski
tomasz.kalinowski@icloud.com

On 05 Nov 2014, at 17:31, ignace nyamagana butera notifications@github.com wrote:

Assuming your are getting a CSV in a different locale as yours, you should first try to use the stream filtering capabilities as explained in the documentation and in the example.
Hope it will help


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant