Le Fri, 07 May 2010 13:05:52 +0200, Victor Stinner a écrit : > > UTF-8 is not a good choice for the fallback because it's incompatible > with other encodings like Latin1. I would like to fallback to ASCII on > error which is compatible with all encodings (thanks to > surrogateescape).
What do you mean with "compatible with all encodings thanks to surrogateescape"? >>> "àéè".encode("ascii", "surrogateescape") Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) > I would like to ensure that sys.getfilesystemencoding() result cannot be > None, because Python 3.2 uses it on Unix to decode os.environb and to > encode filenames in subprocess. I can implement a fallback for > os.environb and subprocess (and other functions calling > sys.getfilesystemencoding()), but I prefer to have a reliable > sys.getfilesystemencoding() function. Having a reliable sys.getfilesystemencoding() would be a good thing indeed. > This change doesn't concern Windows and Mac OS X because the encoding is > hardcoded (mbcs, utf-8). On Unix, I don't know in which case > nl_langinfo() can fail. Empty environment is not an error: > nl_langinfo(CODESET) returns "ascii". I think that few (or no) user > would notice this change. Ok, it sounds like a good compromise. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com