Skip to content

CSV - BOM detection #1669

@norberttech

Description

@norberttech

As reported by Rajesh on X, BOM might be a bit problematic. Please read more about BOM here.

Image

BOM detection could happen here: https://github.com/flow-php/flow/blob/1.x/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/CSVExtractor.php#L45-L54

Ideally the reader should check for BOM and when it's present just skip and while reading the content. (It's important to remember that we should not modify the file as it might be remote readonly file) and instead we need to start reading from a different byte offset.

As for the API I think this should be built in and automatically enabled, but there shuld be an option to disable BOM detecttion through:

CSVExtractor::withBOMDetection(bool $enabled = true)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions