public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@Shaw.ca>
To: cygwin@cygwin.com
Subject: Re: [ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin
Date: Sun, 12 Mar 2023 23:40:48 -0600	[thread overview]
Message-ID: <c68856f3-7b4c-5417-4a69-4a0eccf248f2@Shaw.ca> (raw)
In-Reply-To: <PH0PR05MB9918E3261DF25870A4834D3AA4B99@PH0PR05MB9918.namprd05.prod.outlook.com>

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

  reply	other threads:[~2023-03-13  5:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  0:40 Yeo Kai Wei
2023-03-13  5:40 ` Brian Inglis [this message]
2023-03-13 10:49 ` Corinna Vinschen
2023-03-14  1:30   ` Yeo Kai Wei
2023-03-14  3:44     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-03-14  4:20       ` Brian Inglis
2023-03-14 10:17     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c68856f3-7b4c-5417-4a69-4a0eccf248f2@Shaw.ca \
    --to=brian.inglis@shaw.ca \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).