Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
retype doesn't check source encodings before parsing #2
I was trying to retype a file, but the file had a comment that contained Unicode characters.
Example file (core.py):
#This is a comment with unicode characters: "Афон" foo = "bar"
Example stub (types/core.pyi):
I would have expected it to not crash on files with Unicode characters, especially since the characters are within comments.
On Windows (10), this is
However, it is also possible for users to define their own source encoding using a comment syntax as defined in PEP 263.
So it seems that in an ideal world, retype would determine the encoding from these PEP 263 comment lines, defaulting to UTF-8.