Antoine Pitrou added the comment:

Interesting. The doc is wrong here: pathlib was designed so that it only 
accepts text strings.

> If I use "surrogateescape" (see PEP383) how can I display the
> fake-unicode path to the user? `print()` does seems to use strict
> encoding. Should I encode it with "surrogateescape" or "ignore" myself 
> beforehand?

Yes, you should probably encode it yourself. If you are sure your terminal can 
eat the original bytestring, then use "surrogateescape". Otherwise, "replace" 
sounds better so that the user knows there are some undecodable characters out 
there.

----------
nosy: +ncoghlan, pitrou

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23904>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to