FastCSV is capable of reading CSV files with a Byte order mark
(BOM) header.
Enabling automatic BOM header detection can impact performance.
Due to the decreased usage of BOM headers in modern applications, BOM header detection is disabled by default.
To enable BOM header detection, use the detectBomHeader method of the CsvReaderBuilder class.
You may also want to check out the corresponding
Javadoc
for more information.
The following table shows the BOM headers for different Unicode encodings that FastCSV can detect:
Encoding
BOM header (hex)
UTF-8
EF BB BF
UTF-16 (BE)
FE FF
UTF-16 (LE)
FF FE
UTF-32 (BE)
00 00 FE FF
UTF-32 (LE)
FF FE 00 00
Example
In the following example, a CSV file with a BOM header is created and read using FastCSV.