https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119593
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tomasz Kaminski <tkami...@gcc.gnu.org>: https://gcc.gnu.org/g:5c7f6272f43f4265dc08eac4ee91164672c1c441 commit r15-9178-g5c7f6272f43f4265dc08eac4ee91164672c1c441 Author: Tomasz KamiÅski <tkami...@redhat.com> Date: Thu Apr 3 10:23:45 2025 +0200 libstdc++: Fix handling of field width for wide strings and characters [PR119593] This patch corrects handling of UTF-32LE and UTF32-BE in __unicode::__literal_encoding_is_unicode<_CharT>, so they are recognized as unicode and functions produces correct result for wchar_t. Use `__unicode::__field_width` to compute the estimated witdh of the charcter for unicode wide encoding. PR libstdc++/119593 libstdc++-v3/ChangeLog: * include/bits/unicode.h (__unicode::__literal_encoding_is_unicode<_CharT>): Corrected handing for UTF-16 and UTF-32 with "LE" or "BE" suffix. * include/std/format (__formatter_str::_S_character_width): Define. (__formatter_str::_S_character_width): Updated passed char length. * testsuite/std/format/functions/format.cc: Test for wchar_t. Reviewed-by: Jonathan Wakely <jwak...@redhat.com> Signed-off-by: Tomasz KamiÅski <tkami...@redhat.com>