ham1 opened a new issue, #6896:
URL: https://github.com/apache/jmeter/issues/6896
### Expected behavior
A UTF-8 byte order mark (BOM) at the start of a CSV file is skipped, as in
JMeter 5.6.3.
Excel adds one when you save as "CSV UTF-8".
### Actual behavior
With **File encoding** set to `UTF-8`, the BOM stays attached to the first
thing in the file.
- Variable names taken from the header row: the first variable, `${user}`,
is never resolved. The others work.
- Variable names typed into the element: the first value in the file starts
with an invisible `U+FEFF`.
No error or warning is shown. Leaving **File encoding** empty avoids the
problem.
### Steps to reproduce the problem
1. Create the CSV file:
```sh
printf '\357\273\277user,pass\nalice,secret\n' > bom.csv
```
2. Add a Thread Group (1 thread, 1 loop).
3. Add a CSV Data Set Config: Filename `bom.csv`, File encoding `UTF-8`,
Variable Names empty.
4. Add a Debug Sampler named `user=[${user}] pass=[${pass}]`.
5. Add a View Results Tree and run.
| File encoding | Sample name |
| --- | --- |
| `UTF-8` | `user=[${user}] pass=[secret]` |
| empty | `user=[alice] pass=[secret]` |
### Cause
f5518e3481 ("remove the use of commons-io and commons-text") changed
`FileServer.createBufferedReader`.
When an encoding is set, it now uses `Files.newBufferedReader`, which does
not skip the BOM.
Before, the stream was wrapped in commons-io `BOMInputStream` in all cases,
which skips a UTF-8 BOM.
The BOM test in `FileServerTest` that I looked at reserves the file without
an encoding.
I compared the old and new reader calls on the same file; I did not run the
steps above on 5.6.3.
### JMeter Version
6.0.0-SNAPSHOT (d2e4d08d0e)
### Java Version
Temurin 25.0.5.1
### OS Version
Linux 7.1.8-200.fc44.aarch64 (Fedora 44 kernel)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]