[3.13] gh-124476: Fix decoding from the locale encoding in the C.UTF-8 locale (GH-132477) (ПР-132528)

(cherry picked from commit 102f825c51)
This commit is contained in:
Serhiy Storchaka 2025-04-14 21:59:07 +03:00 committed by GitHub
parent bdff88b9aa
commit f218549afc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 9 deletions

View file

@ -523,15 +523,7 @@ decode_current_locale(const char* arg, wchar_t **wstr, size_t *wlen,
break;
}
if (converted == INCOMPLETE_CHARACTER) {
/* Incomplete character. This should never happen,
since we provide everything that we have -
unless there is a bug in the C library, or I
misunderstood how mbrtowc works. */
goto decode_error;
}
if (converted == DECODE_ERROR) {
if (converted == DECODE_ERROR || converted == INCOMPLETE_CHARACTER) {
if (!surrogateescape) {
goto decode_error;
}