pytest-dev / iniconfig

MIT License
58 stars 31 forks source link

Decode error in pytest.ini with chinese characters #5 #39

Closed RobertT93 closed 2 years ago

RobertT93 commented 2 years ago

seems to fix Decode error in pytest.ini with chinese characters #5 https://github.com/pytest-dev/iniconfig/issues/5

RobertT93 commented 2 years ago

sorry this is not the right way to do this

dongfangtianyu commented 2 years ago

Hey @RobertT93, what happened. Why do you think it's incorrect?

iniconfig announced that it supports comments , so it seems right to open files using utf8.

RobertT93 commented 2 years ago

Hey @RobertT93, what happened. Why do you think it's incorrect?

iniconfig announced that it supports comments , so it seems right to open files using utf8.

code right now use open without encoding parameter, in this way python gets default encoding for system. "The default encoding is platform dependent (whatever locale.getpreferredencoding() returns)," In this pull request i hardcoded this as utf-8. This may lead to change of behavior. in another thread adding parameter to pytest was suggested and i think this may be the key https://github.com/pytest-dev/iniconfig/pull/38