delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/03/13/01:44:52

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 247A6385842D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1678686248;
bh=WgrbprezpB6+unjisrP/uNJPZI3yI388iHVCOPayoa0=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=smxura87w/JKvzd2jwJBlH004/CpFwOhS/XXJn7kUpOaAU3oPv2N6PGybDstaJVyK
bkP4+7Hb0mHVfkjrvfdH69EDHZSdA/Sxn25/U5qpJEaEbonhxZO05RLvcri2op7BEL
eLA4LdoYxekBAjix6pu0xw/3RKv0Xi4VYB8MLqHQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6890E3858D32
X-Authority-Analysis: v=2.4 cv=VbHkgXl9 c=1 sm=1 tr=0 ts=640eb761
a=DxHlV3/gbUaP7LOF0QAmaA==:117 a=DxHlV3/gbUaP7LOF0QAmaA==:17
a=IkcTkHD0fZMA:10 a=yMhMjlubAAAA:8 a=Luou0NOWAAAA:8 a=yuJ0Uhft01uisukBEcoA:9
a=QEXdDO2ut3YA:10 a=_8sh-BOXS069i1rCkLyZ:22 a=NWVoK91CQySWRX1oVYDe:22
a=akQNnlEPo0dw9OMZ98gL:22 a=_VvsggWwU7byVslUopaJ:22 a=OyhXfnr9WZvuyiWoDv4N:22
Message-ID: <c68856f3-7b4c-5417-4a69-4a0eccf248f2@Shaw.ca>
Date: Sun, 12 Mar 2023 23:40:48 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.8.0
Subject: Re: [ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin
To: cygwin AT cygwin DOT com
References: <PH0PR05MB9918E3261DF25870A4834D3AA4B99 AT PH0PR05MB9918 DOT namprd05 DOT prod DOT outlook DOT com>
Organization: Inglis
In-Reply-To: <PH0PR05MB9918E3261DF25870A4834D3AA4B99@PH0PR05MB9918.namprd05.prod.outlook.com>
X-CMAE-Envelope: MS4xfMk68vzZ2hrebQzX00LxoXXHTYYO1VDIz0G8lpM+1jqwlyiqp9jiAKuN9ZXTDlzGkUnWvRJOc8RsqDS5hSPySF9U45AgbPeZhNtkrb/3oErcOeipubY0
oYRYSqIqvuMPjcc38JWGpKfcp/n9N/R8UQNJyHU2ZnfGwsyNSYmzNf9yww6LEjhDy8N9GmIpy/OQJQ==
X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_05, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW,
RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS,
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
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT Shaw DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 32D5iXIS016443

On 2023-03-12 18:40, Yeo Kai Wei via Cygwin wrote:
> May I ask if there's a bug with Cygwin and Windows currency?

Windows Language Locale culture codes and currencies

> This is the output from the code below.
> Region: en_AU.utf-8 Currency symbol: $ International currency symbol: AUD
> Region: en_CA.utf-8 Currency symbol: $ International currency symbol: CAD
> Region: en_GB.utf-8 Currency symbol: £ International currency symbol: GBP
> Region: en_US.utf-8 Currency symbol: $ International currency symbol: USD
> Region: en_NZ.utf-8 Currency symbol: $ International currency symbol: NZD
> Region: en_ZM.utf-8 Currency symbol: $ International currency symbol: NZD <---- 
> ERROR
> The correct answer should be "Region: en_ZM.utf-8 Currency symbol: K 
> International currency symbol: ZMK"
                                  ZMW Zambia kwacha

Install Cygwin package units and see /usr/share/units/currencies.units:

$ units_cur
$ grep zambia /usr/share/units/currency.units
ZMW                    zambiakwacha
zambiakwacha              0.049970632087833 USD

> Supposedly, the code works on Linux.
> Is this an issue with Windows?
> How can one solve this issue?
If you look at the Windows Locale culture id ref:

https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f?source=recommendations

https://winprotocoldoc.blob.core.windows.net/productionwindowsarchives/MS-LCID/%5bMS-LCID%5d.pdf

only two official languages are supported for Zambia and only since Windows 10:

"...
Language	Location	Language	Language	Supported
		(or type)	ID		tag		version
...
Bemba		Zambia		0x1000		bem-ZM		Release 10
...
English		Zambia		0x1000		en-ZM		Release 10
...
Language	Language
ID		tag
0x1000		Locale without assigned LCID if the current user default locale.
		See section 2.2.1.
...
2.2.1 Locale Names without LCIDs
Every locale name without an assigned LCID MAY be temporarily given one of the 
LCIDs in the following table, if the application requests an LCID.<14> These 
locale names include any valid [RFC5646] language tag.
Note: LCID assignments for Locale Names without LCIDs are temporary and are not 
suitable for use across a protocol, or for interchange between processes or 
machines.
These temporary LCID assignments are also unsuitable for tagging persisted data 
as the meaning of the LCID assignment will change over time.
...
Name				Value	Conditions
LOCALE_CUSTOM_UNSPECIFIED<17>	0x1000	When an LCID is requested for a locale 
without a permanent LCID assignment, nor a temporary assignment as above, the 
protocol will respond with LOCALE_CUSTOM_UNSPECIFIED for all such locales. 
Because this single value is used for numerous possible locale names, it is 
impossible to round trip this locale, even temporarily.
Applications should discard this value as soon as possible and never persist it. 
If the system is forced to respond to a request for LCID_CUSTOM_UNSPECIFIED, it 
will fall back to the current user locale. This is often incorrect but may 
prevent an application or component from failing.
As the meaning of this temporary LCID is unstable, it should never be used for 
interchange or persisted data.
This is a 1-to-many relationship that is very unstable.
..."

So it looks like you can only use this if you set this to the current user 
default locale, or set that up under your own custom locale using one of the 
other termporary assignment ids available, and set the current user default 
locale to that.

Instructions for doing so are available out there on the web if you search hard!

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019