public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "carlos at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/95048] wstring-constructor of std::filesystem::path throws for non-ASCII characters
Date: Mon, 11 May 2020 20:59:42 +0000 [thread overview]
Message-ID: <bug-95048-4-BsqPGXR6Ai@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95048-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95048
Carlos O'Donell <carlos at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |carlos at redhat dot com
--- Comment #2 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Jonathan Wakely from comment #1)
> This happens because glibc won't convert the wide string to UTF-8:
>
> #include <wchar.h>
> #include <assert.h>
>
> int main()
> {
> const wchar_t wstr[] = L"ä";
> const wchar_t* from = wstr;
> char to[10];
> mbstate_t s;
> size_t res = wcsnrtombs(to, &from, 1, sizeof(to), &s);
> assert(res != (size_t)-1);
> }
>
> I'm not yet sure why glibc refuses to convert that.
ISO C says:
"At program startup, the equivalent of
setlocale(LC_ALL, "C");
is executed."
Which means you are trying to convert UTF-8 to ASCII.
You should call setlocale with a non-ASCII character set to make this work.
next prev parent reply other threads:[~2020-05-11 20:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 7:59 [Bug libstdc++/95048] New: " kontakt at neonfoto dot de
2020-05-11 20:49 ` [Bug libstdc++/95048] " redi at gcc dot gnu.org
2020-05-11 20:59 ` carlos at redhat dot com [this message]
2020-05-11 21:14 ` [Bug libstdc++/95048] [9/10/11 Regression] " redi at gcc dot gnu.org
2020-05-11 21:19 ` redi at gcc dot gnu.org
2020-05-11 21:25 ` redi at gcc dot gnu.org
2020-06-26 12:05 ` rguenth at gcc dot gnu.org
2020-11-12 13:48 ` gcc-bugzilla at m dot chronial.de
2020-11-12 13:58 ` redi at gcc dot gnu.org
2020-11-12 14:02 ` redi at gcc dot gnu.org
2020-11-12 23:49 ` gcc-bugzilla at m dot chronial.de
2021-01-14 8:44 ` rguenth at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-06-01 8:17 ` [Bug libstdc++/95048] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-07-23 12:40 ` gcc-bugzilla at m dot chronial.de
2021-10-19 13:25 ` redi at gcc dot gnu.org
2022-05-27 9:42 ` [Bug libstdc++/95048] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:40 ` jakub at gcc dot gnu.org
2022-10-24 15:09 ` ulf.lorenz at ptvgroup dot com
2022-10-25 11:54 ` redi at gcc dot gnu.org
2022-10-25 12:47 ` ulf.lorenz at ptvgroup dot com
2022-11-11 17:43 ` cvs-commit at gcc dot gnu.org
2022-11-11 17:46 ` [Bug libstdc++/95048] [10/11/12 " redi at gcc dot gnu.org
2022-11-11 17:51 ` redi at gcc dot gnu.org
2022-11-11 22:29 ` cvs-commit at gcc dot gnu.org
2022-11-14 18:34 ` cvs-commit at gcc dot gnu.org
2022-11-22 11:51 ` [Bug libstdc++/95048] [10/11 " ulf.lorenz at ptvgroup dot com
2022-11-22 12:30 ` redi at gcc dot gnu.org
2023-07-07 10:37 ` [Bug libstdc++/95048] [11 " rguenth at gcc dot gnu.org
2023-07-10 15:47 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:04 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:16 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:19 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:23 ` cvs-commit at gcc dot gnu.org
2023-07-12 20:24 ` redi at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-95048-4-BsqPGXR6Ai@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).