On Tue, 10 Jan 2023 at 12:59, Dimitrij Mijoski via Libstdc++ <libstd...@gcc.gnu.org> wrote: > > Fixes the conversion from UTF-8 to UTF-16 to properly return partial > instead ok. > Fixes the conversion from UTF-16 to UTF-8 to properly return partial > instead ok. > Fixes the conversion from UTF-8 to UCS-2 to properly return partial > instead error. > Fixes the conversion from UTF-8 to UCS-2 to treat 4-byte UTF-8 sequences > as error just by seeing the leading byte. > Fixes UTF-8 decoding for all codecvts so they detect error at the end of > the input range when the last code point is also incomplete. > > libstdc++-v3/ChangeLog: > PR libstdc++/86419 > * src/c++11/codecvt.cc: Fix bugs. > * testsuite/22_locale/codecvt/codecvt_unicode.cc: New tests. > * testsuite/22_locale/codecvt/codecvt_unicode.h: New tests. > * testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc: New > tests.
I'm just finishing testing and will push this. I had to add <memory> to the new codecvt_unicode.h header, and fixed some formatting in codecvt (we don't put a space before function parameter lists in the libstdc++ code, unlike in the code for the GCC compiler itself). I've also made the changelog entry a bit more descriptive. Thanks again for the bug report and for fixing it!