From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by sourceware.org (Postfix) with ESMTPS id 9D217385841B for ; Fri, 11 Feb 2022 19:35:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D217385841B Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MD9nd-1nReGX28Gn-009Buo; Fri, 11 Feb 2022 20:35:52 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 092EEA80DA1; Fri, 11 Feb 2022 20:35:52 +0100 (CET) Date: Fri, 11 Feb 2022 20:35:51 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Cc: Achim Gratz Subject: Re: [:xdigit:] does not work with std::wstring in a Cygwin environment Message-ID: Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, Achim Gratz References: <53a83ef8dcc847e2914be35aa8c4525a@brillux.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <53a83ef8dcc847e2914be35aa8c4525a@brillux.de> X-Provags-ID: V03:K1:Lmy1zwiapbUr6ZGsSplFVB7ujRRyv8ctruwYcPQ4Fpi9TD2CZxW JKbNM8XzsJUl0NUMV76Ww4l2+rEBI0AzMZxJi+orGDND9KbGwuYs4Ot1Ncy77GFroAUl16U 8yfjM8dKQxV3IbH/uUZFIGTjorIrNx/lVGxhtTJ0BzHvzl3qqrNbv1tQtZiD/K+XG1p9T1Y IQ0SiUNcQwF7UbsfDUugQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:j95dxGk8p7A=:Vxr8SwFaekZFESBruVQqrt viJ07+g/2AX7GImoRM0kb+LZy1qwRXR9FdD4IImhEy4IUb+ObZQTLYC1XtAyjZ6ZfSUHVYrkL +a6VWomIQX2d3EAQhL6XMEZhwAqhzG7WFMiPwykKPm8xzPoANJc3yFnroCY8vuyHd+HtwNYu6 UcWLSYizxb+ehv+nzwm9ES7Id46aeQE8ATLPRFAEintVE3s+g7LTLRmlxkDHoq6+LggS/m7mL /ZaT7JFI6wyG7+BNhGQgu3gyJFnzmvSStEAekxTvuJzBhZweBa3NN+v1EibLt4cnw+whfPj5O Zm8mVs0uHUz4HbVWXxp3QA1T/qvIcu8uq+MolfQJ0nm9RzXk1ys8AvI+fETB215Byb36yyTpp nULc9vgYJUndJ5tNS1wtiLIYmZMW1BwkCDaDilkvFceJzK1GnwLUNb6Vov/dAB1m+hSuQvld/ Z2uQ1ZipDyCHdCycZIb29mKB48ZXeYckbyZ+0v/zaC71W7C+5tw//KYeZcegO3dhKpNv7wXJV +2glo9lGfWW8pjx1QbLAF5KblR1m6NA6OJZqaRRgCKvkSiuhMkfyVabv1MtaEqbwILsWKBjDs 0Y9dxFOnZkYSM/avFTQXZHfu8y/Vue/4N7xClPg7aXUjWAmQsnYmnquANgtfqvzGQX8DVFV2z Q4HmadzAyd5hlog2KeYBCJNyuBnTRUeFdxjfmY5UvGwbOWOCu0SFPI5XZ9DR2mPSNMpiL/rOK kGi0pj8xzuTE8BXd X-Spam-Status: No, score=-96.2 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_ASCII_DIVIDERS, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_FAIL, SPF_HELO_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2022 19:36:02 -0000 On Feb 11 16:02, Gans, Markus wrote: > This seems to be an internal Cygwin error: > > https://www.reddit.com/r/cpp_questions/comments/sp52gq/xdigit_does_not_work_with_stdwstring_in_a_cygwin/ > > ------------------------------------------------------------------------------ > I have an unexpected behavior with Cygwin for the character class [:xdigit:]. The pattern matching for [:xdigit:] behaves like the pattern matching of [:digit:] when using a wide string. With `std::string` everything works fine. > > Example: > > #include > #include > #include > > int main () > { > std::cout << "Wide character string\n"; > std::wstring w_character = L"a"; > > if ( regex_match(w_character, std::wregex(L"[[:xdigit:]]")) ) > std::cout << "'" << char(w_character[0]) << "' is a hex digit\n"; > else > std::cout << "'" << char(w_character[0]) << "' is not a hex digit\n"; > > std::cout << "----------------------\n" > << "String with 1 byte character\n"; > std::string character = "a"; > > if ( regex_match(character, std::regex("[[:xdigit:]]")) ) > std::cout << "'" << char(w_character[0]) << "' is a hex digit\n"; > else > std::cout << "'" << char(w_character[0]) << "' is not a hex digit\n"; > > return 0; > } > > Output in a Cygwin environment: > > Wide character string > 'a' is not a hex digit > ---------------------- > Character string > 'a' is a hex digit > > Output on Linux: > > Wide character string > 'a' is a hex digit > ---------------------- > String with 1 byte character > 'a' is a hex digit > > Question: Why does Cygwin not detect the letters a, b, c, d, e, and f as hexadecimal digits in a wide string? > ------------------------------------------------------------------------------ This seems to be a bug in libstdc++. None of the above functions call any internal library function which could affect the result. That means regcomp(3), regexec(3), isxdigit{_l}(3) or iswxdigit{_l}(3). Achim, any idea? Is wchar support broken in Cygwin's libstdc++, by any chance? Corinna