X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FC4338555A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1679744966; bh=A2rP2+v9TkgxYs6BqwK6SL37na7dAMhHKh39m60ZDpo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UXo38XvH+uzEaZmE42MdTMgw3691iwmS0EW+m+AzGe7zv3mREsm+SDxzIX7fK4aGy JuY/pxzUJb/eFWZmoBH8jcZrpgS3TkZ8bpwP/mMl4Pa2f7xR8WmYSgXQH5eYfv2SQP +tP8xbjanbRNhsC5IUVXQPI/iNTM31lajf+G7gmk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 255FD3858D1E Date: Sat, 25 Mar 2023 12:49:06 +0100 To: cygwin AT cygwin DOT com Subject: Re: newlocale: Linux incompatibility Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:5S8n7UAOcCEAIWLEZQcNDbmQWYsk9dwyA4Wp1SVfUOvT0yOlycP JQ3kLPFfIOuDXF7W6HGk4pT0Bhw4gp6w2U4ff7eUnNXIHWrNdDJZ9Cm3F0atEap8VNP1g3d C1qf7uTEtQqYR7aDl68mAHnL2GHHItm+BKCtKmfrThtukdhdiZpdmf3zXTMa/XkEGslDnyn Xeh6UQ9q6DNsGvJYthy9g== UI-OutboundReport: notjunk:1;M01:P0:QT4ywd6XXC8=;iNjN5qwifGAmzUOaABJ4xpmk6Mx eepnRY2XzJbjkQCSr69b/SrQiFQbEuOW43jZMOfuTteETaRyXRlM/tS61jg8jyFKpJSt+XYHd 4JC+retLNPzbo6kRuSizj9lA3vSS5Hlkj44C0dLMdJxLvUGuaiGTG5leZqQSQfsyZhaWBCb2T gjRUbMpjvylvkWNiAORn8+Y2pIPftMuS2FwdG53px/Fcxm3K4g9x7Hzfx2AFDHd/pceGkIyqg 6sRVGEP2OzYYB+VTzbT4cXIHPLhz1QPO38yIn06Q0F8TjuQPfKl6xCVsZQo/6dTSPCWk1otkw LBT4SGBnMsQzq2vnFaQsRjKo9VKst1tYiRfVcYAAZLl6SpzCszAOsZNvfUA5fCn4zYL64CbPi lBBjKJTxxTlwPe5bWWTBHP/BV6ItFHS3jAqO6cBAXvef6ray+B5cKir7nt/9DuqN6A/H6kyhJ ODklVkoQGcaSMG4hnIbdSclMdOnJXHyaS3m/OjzDUyUMyEELz4GVc2Byd3FcQnTag+4sGfSCm ShOozQF/xvH5lW0m1uxlJpAmqL7dNIIsFnI1L5ARD/x5o11MNCgM85xrtDhsAbVXa0YyszzCR ZN6hmkOQQA8p1lprottqcFZfAwgID8K9cAJQkIMpVdo65u5nQDiQSm/T8vmNXYq9tD7K1BbPh pyZBaapVBLeehDEArKC9aurXpXhhq9DpU9P5Hc4n2g== X-Spam-Status: No, score=-97.6 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_FAIL, SPF_HELO_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen 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 Mar 24 16:49, Brian Inglis via Cygwin wrote: > On 2023-03-24 06:18, Corinna Vinschen via Cygwin wrote: > > > First, it's a bug in the Emacs testsuite. The test simply assumes that > > > there's no en_DE locale on any system, but that's just not true. > > > Windows support the RFC 5646 locale "en-DE", which is called "English > > > (Germany)" in the "Region" settings. > > > > > > You can also check with `locale -av | less' and search for en_DE. > > > > > > For the reminder of this mail, I assume you're talking about Cygwin 3.5. > > > I won't fix this for 3.4 anymore, given how much locale handling has > > > changed for 3.5. > > > > > > The second bug is that Cygwin blindly trusts the Windows function > > > ResolveLocaleName(). That function blatantly converts even vaguely > > > similar locales into something it supports. E.g., it converts "en-XY" > > > to "en-US". I. .e., even if you use "en_XY.utf8" as locale, the above > > > testcase will wrongly succeed. So I have to rethink how I resolve POSIX > > > locales to Windows locales. > > Does Windows even consider https://www.rfc-editor.org/rfc/rfc4647 "Matching > of Language Tags", part of https://www.rfc-editor.org/info/bcp47 "Language > Tags", and if POSIX only matches exactly, will LANGUAGE be able to be used > for fallback? I never heard about an environment variable called LANGUAGE. This is about LANG/LC_ALL/LC_whatever, so POSIX syntax is required... > I currently define LANGUAGE=en_CA:en_GB:en in case en-CA is unsupported by > anything. > [I use my own en-CA locale not the glibc default created by https://rap.dk/.] > > Will "-" be supported like "_" as a separator in values? In Cygwin? No. The POSIX syntax is required, it's converted into a matching Windows RFC 5646 locale internally. > > > And the third bug is that Cygwin fails to set errno if it doesn't > > > support a locale, but that's a minor inconvenience in comparison. > > > > > > Thanks for the report, I totally missed the above problem with > > > ResolveLocaleName. > > > > I pushed a couple of patches which hopefully clean up the code. It's > > really frustrating how these Windows locale functions work. Or, rather, > > not work. I mean, come on... > > > > - ResolveLocaleName() resolves "ff-BF" to "ff-Latn-SN", not to > > "ff-Adlm-BF" or "ff-Latn-BF", even though both exist. > > > > - There's a locale called "sd-Arab-PK" and a locale "sd-Deva-IN". If > > you ask for the script used in "sd-IN", the result is "Arab", not > > "Deva". > > > > I had to create a replacement function for ResolveLocaleName which > > doesn't return totally screwy and unexpected results, and special case > > two more locales in /proc/locales output so the output makes sense. > > Aha - a nice new 3.5.0 feature - as well as /proc/codesets - is that > charsets e.g. ISO-10646, etc. rather than encodings e.g. UTF-8, etc.! It's a list of what you can use as codeset in $LANG and friends as in LC_CTYPE=lang_TERRITORY DOT codeset AT modifier 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