When executing load_dotenv() with a .env file saved in a BOM (Byte Order Mark) aware format, the first environment variable is silently ignored, but the rest are added.
I assume this occurs since an invisible character is added at the beginning of the .env file, and that line is ignored. This can be problematic since it is an invisible character, a silent error, and also JetBrains IDEs like to set BOM by default when opening .env files (at least in Windows environments)
Steps to reproduce:
- Use any version of python-dotenv from 1.0.1 to 1.2.2
- Create a .env file with BOM
- Add several variables
- load_dotenv
=> All variables are loaded but the first one.
My expected behaviour: explicit fail or load of all environment variables.
Thanks a lot in advance to the reader, answerer, and anyone who contributes to this repository.