summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2018-01-15 23:43:24 +0100
committerGitHub <noreply@github.com>2018-01-15 23:43:24 +0100
commitb92c159efada05b3a5ff9d0dbce3fcb2334631f6 (patch)
treee0c7a7c67133cd4b7e6b17383ff69e2b7e5e11cc /Include
parent5f959c4f9eca404b8bc4bc6348fed27c4b907b89 (diff)
downloadcpython-git-b92c159efada05b3a5ff9d0dbce3fcb2334631f6.tar.gz
[3.6] bpo-32555: Fix locale encodings (#5193)
On FreeBSD and Solaris, os.strerror() now always decode the byte string from the current locale encoding, rather than using ASCII/surrogateescape in some cases. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() which has an additional current_locale parameter. * PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and * PyUnicode_EncodeLocale() now always use the current locale * encoding, instead of using Py_DecodeLocale()/Py_EncodeLocale(). * Document encoding in Py_DecodeLocale() and Py_EncodeLocale() documentations. * Add USE_FORCE_ASCII define to not define decode_ascii_surrogateescape() on Android.
Diffstat (limited to 'Include')
-rw-r--r--Include/fileutils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Include/fileutils.h b/Include/fileutils.h
index 875715df97..8fa70baa21 100644
--- a/Include/fileutils.h
+++ b/Include/fileutils.h
@@ -17,6 +17,16 @@ PyAPI_FUNC(char*) Py_EncodeLocale(
#ifndef Py_LIMITED_API
+PyAPI_FUNC(wchar_t *) _Py_DecodeLocaleEx(
+ const char *arg,
+ size_t *size,
+ int current_locale);
+
+PyAPI_FUNC(char*) _Py_EncodeLocaleEx(
+ const wchar_t *text,
+ size_t *error_pos,
+ int current_locale);
+
PyAPI_FUNC(PyObject *) _Py_device_encoding(int);
#ifdef MS_WINDOWS