On Wed, Mar 17, 2021 at 5:33 PM Paul Moore firstname.lastname@example.org wrote:
On Wed, 17 Mar 2021 at 08:13, Michał Górny email@example.com wrote:
On Wed, 2021-03-17 at 13:55 +0900, Inada Naoki wrote:
OK. setuptools doesn't specify encoding at all. So locale-specific encoding is used. We can not fix it in short term.
How about writing paths as bytestrings in the long term? I think this should eliminate the necessity of knowing the correct encoding for the filesystem.
If I have a path in my Python program that is "a£b" (a unicode string) and I want to write it to a .pth file, what encoding should I use to "write it as a bytestring"? I don't understand what you;re trying to suggest here. Paul
On Windows, it must be UTF-8. For example, we use `chcp 65001` in `activate.bat` to support unicode path. On Unix, raw path is bytestring. So paths can be written as-is. Python decode it with fsencoding.
So I think this is the ideal solution. But this solution requires platform-specific code in the site.py. I don't think pth files are important enough for this complexity.
Sub-optimal idea is using UTF-8. It is the best encoding for Windows. And most Unix systems use UTF-8 too.