On Wed, Mar 17, 2021 at 5:33 PM Paul Moore <p.f.mo...@gmail.com> wrote: > > On Wed, 17 Mar 2021 at 08:13, Michał Górny <mgo...@gentoo.org> 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. Regards, -- Inada Naoki <songofaca...@gmail.com> _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NWBYQHLUIIWU2U2MX4KZXJH4PBTNJYAW/ Code of Conduct: http://python.org/psf/codeofconduct/