black crashes when internal function get_gitignore
tries to use gbk encoding to read a .gitignore file containing certain Chinese characters
#1537
Labels
Describe the bug
black crashes when internal function
get_gitignore
tries to usegbk
encoding to read a .gitignore file containing certain Chinese characters.To Reproduce
The issue is related to Chinese language platform. So reproduction may not work in other language platform. On Chinese language platform, the builtin
open()
function defaults to use gbk encoding, and this is where the problem originates.mkdir playground cd playground
Expected behavior
Black should not crash when encountering .gitignore files that contain Chinese characters.
Environment (please complete the following information):
Does this bug also happen on master?
Yes.
Possible solution
black's internal function
get_gitignore
could explicitly use UTF-8 encoding when reading from .gitignore files. Then nothing should crash. This issue is similar to the one in Gita nosarthur/gita#74.The text was updated successfully, but these errors were encountered: