[libc++][windows] Use _wsetlocale() in __locale_guard (#160479)
On Windows, locale strings are not limited to ASCII characters, and
narrow locale strings are encoded relative to the `LC_CTYPE` charset.
Class `__locale_guard` does three things in sequence:
1. Queries the current locale string
2. Sets a temporary locale
3. Restores the locale retrieved at 1
However, the locale string obtained from `1)` may be in an encoding
different from what `setlocale` expects at `3)`
To avoid any problem with narrow string encodings, use `_wsetlocale` in
`__locale_guard`.
Fixes #160478
GitOrigin-RevId: 12f572979922ca10b9c66d6264826f9cbc78f5de
3 files changed