diff -r 464eed5ddb2e Doc/library/sys.rst --- a/Doc/library/sys.rst Mon Aug 19 10:03:11 2013 +0300 +++ b/Doc/library/sys.rst Wed Aug 21 14:52:36 2013 +0200 @@ -1059,6 +1059,8 @@ always available. is interactive (that is, if its :meth:`isatty` method returns True), the console codepage is used, otherwise the ANSI code page. Under other platforms, the locale encoding is used (see :meth:`locale.getpreferredencoding`). + The error handler of the encoding is ``surrogateescape`` (see the + :pep:`383`). Under all platforms though, you can override this value by setting the :envvar:`PYTHONIOENCODING` environment variable. @@ -1082,6 +1084,10 @@ always available. :meth:`~io.BufferedIOBase.detach` method and can raise :exc:`AttributeError` or :exc:`io.UnsupportedOperation`. + .. versionchanged:: 3.4 + The error handler of the encoding is ``surrogateescape`` (see the + :pep:`383`). + .. data:: __stdin__ __stdout__ diff -r 464eed5ddb2e Python/pythonrun.c --- a/Python/pythonrun.c Mon Aug 19 10:03:11 2013 +0300 +++ b/Python/pythonrun.c Wed Aug 21 14:52:36 2013 +0200 @@ -1085,7 +1085,7 @@ initstdio(void) Py_DECREF(wrapper); encoding = Py_GETENV("PYTHONIOENCODING"); - errors = NULL; + errors = "surrogateescape"; if (encoding) { encoding = _PyMem_Strdup(encoding); if (encoding == NULL) {