@@ -3051,13 +3051,7 @@ PyObject *
30513051PyUnicode_EncodeFSDefault (PyObject * unicode )
30523052{
30533053#ifdef HAVE_MBCS
3054- const Py_UNICODE * wstr ;
3055- Py_ssize_t wlen ;
3056-
3057- wstr = PyUnicode_AsUnicodeAndSize (unicode , & wlen );
3058- if (wstr == NULL )
3059- return NULL ;
3060- return PyUnicode_EncodeMBCS (wstr , wlen , NULL );
3054+ return PyUnicode_EncodeCodePage (CP_ACP , unicode , NULL );
30613055#elif defined(__APPLE__ )
30623056 return _PyUnicode_AsUTF8String (unicode , "surrogateescape" );
30633057#else
@@ -3141,15 +3135,8 @@ PyUnicode_AsEncodedString(PyObject *unicode,
31413135 (strcmp (lower , "iso-8859-1" ) == 0 ))
31423136 return _PyUnicode_AsLatin1String (unicode , errors );
31433137#ifdef HAVE_MBCS
3144- else if (strcmp (lower , "mbcs ") == 0 ) {
3145- const Py_UNICODE * wstr ;
3146- Py_ssize_t wlen ;
3147-
3148- wstr = PyUnicode_AsUnicodeAndSize (unicode , & wlen );
3149- if (wstr == NULL )
3150- return NULL ;
3151- return PyUnicode_EncodeMBCS (wstr , wlen , errors );
3152- }
3138+ else if (strcmp (lower , "mbcs ") == 0 )
3139+ return PyUnicode_EncodeCodePage (CP_ACP , unicode , errors );
31533140#endif
31543141 else if (strcmp (lower , "ascii ") == 0 )
31553142 return _PyUnicode_AsASCIIString (unicode , errors );
0 commit comments