-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.env doesn't load at all on Windows #26
Comments
The error is there but UTF-8 with BOM is not supported in this crate. I don't think it should be because BOM in UTF-8 is not recommended by the Unicode spec. You'll have to remove the character. |
Nobody is asking you to "support" writing new files as BOM (nor is the answer you're referring to suggesting that). But you also can't expect users to know what BOM is in the first place. Windows users can't help Windows creating the .env file like that. That's how the OS presented the file to me when creating it in Rider (my IDE). In the editor the character isn't even visible. I had to look up how to manually remove it. See also the second answer on the same question about ignoring the sequence (more relevant to reading files). Respectfully disagree with your assessment. I consider the package erroring over a BOM character to be a needless bug and I don't see why the library couldn't strip it or ignore it, or convert to the desired encoding. |
Thanks for the helpful reply! I agree now that ignoring the BOM makes sense. |
This is marked as completed, but has it been fixed? I still can't seem to get it to work on Windows, and there's no EDIT: This was indeed not linked to a |
I've used dotenv packages in many languages, but this time I got quite confused.
Reason:
dotenvy
)Stacktrace:
I've added
.expect("Failed to load .env file")
instead ofok()
which yields the following output:It seems that this is caused by a
Zero Width No-Break Space (BOM, ZWNBSP)
character: https://www.compart.com/en/unicode/U+FEFF at the start of the file (which isn't visible in the editor.I can confirm that removing the BOM character fixes the issue.
The text was updated successfully, but these errors were encountered: