Skip to content

Add option to validate file encoding - #5

Open
ger4003 wants to merge 4 commits into
masterfrom
feature/csvdataprovider-validate-fileencoding
Open

ger4003 wants to merge 4 commits into
masterfrom
feature/csvdataprovider-validate-fileencoding

Conversation

@ger4003

@ger4003 ger4003 commented Jan 13, 2020

Copy link
Copy Markdown
Contributor

Two new options:

  • csv.fileEncoding
  • csv.fileEncodingValidationEnabled

If csv.fileEncodingValidationEnabled is enabled the content is checked with mb_check_encoding() before file is opend.

self::KEY_ENCLOSURE => '"',
self::KEY_USE_HEADER_ROW => true
self::KEY_USE_HEADER_ROW => true,
self::KEY_FILE_ENCODING => 'UTF-8',

@monofone monofone Jan 13, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excuse my interruption but I don't think it's a good idea to handle validation of file here in the provider ...
This should be done before the file is handed over to the dataprovider

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ;)

I discussed this with Kai and we'll restructure the Importer a bit, so it takes a DataProvider in the import() method. This way we split the creation (and validation) of a data provider from the actual run of the importer. The current design has some issues if the importer is a singleton, since it keeps state between runs.

This will need a new major version since the API changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants