Message105721
PyUnicode_EncodeFSDefault() is the opposite of PyUnicode_DecodeFSDefault(AndSize)() and is similar to the new function os.fsencode(). As you can see in the patch, it simplifies many functions.
/* Encodes a Unicode object to Py_FileSystemDefaultEncoding with the
"surrogateescape" error handler and returns a bytes object.
If Py_FileSystemDefaultEncoding is not set, fall back to UTF-8.
*/
PyAPI_FUNC(PyObject*) PyUnicode_EncodeFSDefault(
PyObject *unicode
);
The function unify the behaviour when Py_FileSystemDefaultEncoding is NULL: use UTF-8 whereas import uses ASCII. Other functions did already fall back to UTF-8: PyUnicode_AsEncodedString() uses PyUnicode_GetDefaultEncoding() (hardcoded to utf8 in Python3) if encoding is NULL
The patch does also fix tkinter module initializer (use surrogateescape error handler, instead of strict).
The patch was first attached to issue #8611. |
|
Date |
User |
Action |
Args |
2010-05-14 16:53:55 | vstinner | set | recipients:
+ vstinner, lemburg, loewis, gregory.p.smith, pitrou, benjamin.peterson, ezio.melotti, Arfrever |
2010-05-14 16:53:54 | vstinner | set | messageid: <1273856034.98.0.139429807226.issue8715@psf.upfronthosting.co.za> |
2010-05-14 16:53:52 | vstinner | link | issue8715 messages |
2010-05-14 16:53:51 | vstinner | create | |
|