Automattic / newspack-custom-content-migrator

Custom migration tasks for launching and migrating Newspack sites on Atomic
5 stars 5 forks source link

Fix/csv file class #412

Closed eddiesshop closed 9 months ago

eddiesshop commented 9 months ago

How to test

Get your most problematic CSV file, and see if this class will read it and process the rows.

$ wp shell
> $csv = ( new FileImportFactory )->get_file( '/path/to/file' )->getIterator();
> foreach ($csv as $row ) {
>     var_dump( $row );
> }

I think this is the best way to handle charsets, but would appreciate if someone more knowledgeable than me could check or confirm.

eddiesshop commented 9 months ago

Thanks for the review @naxoc!

That makes sense, I'll create another PR adding that flexibility.