Closed anthonyshibitov closed 8 months ago
This is a reasonable approach, but what we are going to do instead is add a debug
command to dotenv-vault.
It will output a lot of helpful text if you are:
we started moving the more detailed information mentioned above into dotenvx
- https://github.com/dotenvx/dotenvx
but this is still a great and quick addition. will release as part of next release for dotenv
If no encoding is specified in the options, debug will alert the user that UTF-8 will be used as the default.
From my perspective, there were two resolutions to this issue.
While UTF-8 is one of the few encodings that can be reliably validated without using heuristics, the code to do so is generally not compact or easy to understand, and would require running the validation function on the entire string, in addition to being parsed.
The original issue this fix stems from was a mismatched encoding for .dotenv not conforming with the default UTF-8 (UTF-16-LE was the culprit). Implementing an entire UTF-8 validator function seems to be overkill (both computationally, and code clarity wise) for, from what I can tell, is not a common issue. I think alerting the user of the default encoding only in debug mode is a good compromise to avoid unnecessary bloat.
Please let me know your thoughts. This is my first open source contribution, so any and all critique is welcome.
Thank you! :)
Closes #657