summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-04-30 16:37:52 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-04-30 16:37:52 (GMT)
commitb9a20ad036ea0e4b8dd2f57158375d5138dd0663 (patch)
tree35abb81f2c0c83526901f24af0119ab0c4a315a1 /Objects/unicodeobject.c
parent56d6410c2dfd60c109de6d3a59dab25d29dda9ce (diff)
downloadcpython-b9a20ad036ea0e4b8dd2f57158375d5138dd0663.zip
cpython-b9a20ad036ea0e4b8dd2f57158375d5138dd0663.tar.gz
cpython-b9a20ad036ea0e4b8dd2f57158375d5138dd0663.tar.bz2
PyUnicode_DecodeFSDefaultAndSize() uses surrogateescape error handler
This function is only used to decode Python module filenames, but Python doesn't support surrogates in modules filenames yet. So nobody noticed this minor bug.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 369306e..23b322f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1600,19 +1600,19 @@ PyUnicode_DecodeFSDefaultAndSize(const char *s, Py_ssize_t size)
if (Py_FileSystemDefaultEncoding) {
#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
if (strcmp(Py_FileSystemDefaultEncoding, "mbcs") == 0) {
- return PyUnicode_DecodeMBCS(s, size, "replace");
+ return PyUnicode_DecodeMBCS(s, size, "surrogateescape");
}
#elif defined(__APPLE__)
if (strcmp(Py_FileSystemDefaultEncoding, "utf-8") == 0) {
- return PyUnicode_DecodeUTF8(s, size, "replace");
+ return PyUnicode_DecodeUTF8(s, size, "surrogateescape");
}
#endif
return PyUnicode_Decode(s, size,
Py_FileSystemDefaultEncoding,
- "replace");
+ "surrogateescape");
}
else {
- return PyUnicode_DecodeUTF8(s, size, "replace");
+ return PyUnicode_DecodeUTF8(s, size, "surrogateescape");
}
}