Open reconman opened 2 years ago
As an aside, I think this would be a breaking change--Windows-only users (or anyone with a supported non-utf-8 text encoding set as their locale) may be unwittingly, or intentionally, relying on this behavior.
I agree @mechie , more comments in #189 .
I've changed it to the system default. Tested it with the value Chūnibyō demo Koi ga Shitai!
in a YAML file. If I encode it as CP1252, it can be parsed on Windows. If I use UTF-8 instead, an exception is thrown.
Not really happy with copy-pasting the locale function call everywhere but I'm not a professional Python programmer, so there may be better ways.
Thanks for your PR. Let me think a bit about the best way to handle this. Maybe instead of passing the encoding through several layers of functions, we could introduce a config mechanism.
Fixes #189
I've added some type hints and comments to the user-facing functions. Wasn't sure about the type of
validator
, so it's stillAny
.