nornir-automation / nornir

Pluggable multi-threaded framework with inventory management to help operate collections of devices
https://nornir.readthedocs.io/
Apache License 2.0
1.4k stars 237 forks source link

address UTF-8 error on windows #654

Closed dbarrosop closed 3 years ago

dbarrosop commented 3 years ago

Windows throws the following error when trying to open a UTF-8 encoded file without specifying the encoding:

UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 11744: illegal multibyte sequence

This PR allows users to specify the encoding of SimpleInventory

dbarrosop commented 3 years ago

Looks like GH actions is having troubles and the CI isn't running so I am not sure if I managed to trigger the error there for future testing. In any case, the fix should work. I will check later if the issue is triggered in the CI without the fix.

@nmweizi would you mind testing this? thanks for reporting!

dbarrosop commented 3 years ago

interestingly the error didn't trigger as described but it certainly was caught:

https://github.com/nornir-automation/nornir/runs/2006936942?check_suite_focus=true

Note the error only shows up with windows

ktbyers commented 3 years ago

This looks good to me.

Kirk

nmweizi commented 3 years ago

@dbarrosop This looks good to me too.

dbarrosop commented 3 years ago

Thanks!