From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-out1.brillux.de (mail-out1.brillux.de [80.155.186.198]) by sourceware.org (Postfix) with ESMTPS id B4C6B3858D1E for ; Fri, 11 Feb 2022 16:02:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B4C6B3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=brillux.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brillux.de Received: by mail-out1.brillux.de with ESMTP id 21BG2pgQ014494; Fri, 11 Feb 2022 17:02:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brillux.de; s=k2; t=1644595371; bh=TN2VvhMV6DfLokK98w6SrJZiZjxsLwXy+OT/Pn0zkHw=; h=From:To:Subject:Date; b=jUwsBnip7aT4vWXSMD41izFzkoAEpYWCDLBquE4MCtXgYL5Ms3x3T3aRqTS2ljPnJ 6Os3DWeZAd5EnOAvO2T/p60cG/fmCWwF2Eq6YupU57i+nXDI1ciHW3L43IL93UOk1Z 0LRvOgploWXdrWyGrtefZQ8fS0nxVnNo2zanrXdVU5LVFqEnRBFHOmDzxY7X4B88Gr NjySG81tmi2NZGXQy8kK9kUqUM8d3pjRBHjZcvry4thk8flHYO7BW871/oWTRIp6LW 6UewRXwZ20x52Mzvz0Y7+zmrDEZx9zWltLixoEjnZS1HQXDOlz2qlOMYRae+DnWQ/X y29qeGn/qHISg== Received: from exsrv1.ad.brillux.de (exsrv1.ad.brillux.de [172.16.100.124]) by mail-int1.brillux.de (8.14.4/8.14.4) with ESMTP id 21BG2p6F029310 for ; Fri, 11 Feb 2022 17:02:51 +0100 Received: from exsrv1.ad.brillux.de (172.16.100.124) by exsrv1.ad.brillux.de (172.16.100.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Fri, 11 Feb 2022 17:02:51 +0100 Received: from exsrv1.ad.brillux.de ([fe80::b8b5:65ce:cf61:2bdc]) by exsrv1.ad.brillux.de ([fe80::b8b5:65ce:cf61:2bdc%9]) with mapi id 15.01.2375.017; Fri, 11 Feb 2022 17:02:51 +0100 From: "Gans, Markus" To: "'cygwin@cygwin.com'" Subject: [:xdigit:] does not work with std::wstring in a Cygwin environment Thread-Topic: [:xdigit:] does not work with std::wstring in a Cygwin environment Thread-Index: AdgfX7MgQ8NBn+2iR8au0QqKCrtABg== Date: Fri, 11 Feb 2022 16:02:50 +0000 Message-ID: <53a83ef8dcc847e2914be35aa8c4525a@brillux.de> Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.20.1.143] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 16:02:54 -0000 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 fi= ne. Example: #include #include #include =20 int main () { std::cout << "Wide character string\n"; std::wstring w_character =3D L"a"; =20 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= "; =20 std::cout << "----------------------\n" << "String with 1 byte character\n"; std::string character =3D "a"; =20 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= "; =20 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 he= xadecimal digits in a wide string? ---------------------------------------------------------------------------= ---