X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CD52385802A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1644608190; bh=mOoddBzwvkj3SlfOeBEnqYu0sPS/FUwSGoNnbnJt1kg=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:Cc:From; b=o80MOGlXN0l6vTDNQLSe54PlgwdUA7mrlDWSXZzKgO2CeDyV19HjywtAGYfBIVEMp nJfzeAfO7PQSu3w8iGgn2xyeaHdffRRR0L5xyAEraOT+QeMubwi0910rDTczP2ifXD 5/A3ueQhHQvSsvaGRB0h1Nn7cG816wz7AQuDzCSU= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com 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 Date: Fri, 11 Feb 2022 20:35:51 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [:xdigit:] does not work with std::wstring in a Cygwin environment Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com, Achim Gratz References: <53a83ef8dcc847e2914be35aa8c4525a AT brillux DOT de> MIME-Version: 1.0 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 AT cygwin DOT 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: , Reply-To: cygwin AT cygwin DOT com Cc: Achim Gratz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple