[ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin
Yeo Kai Wei
yeokaiwei@hotmail.com
Tue Mar 14 01:30:02 GMT 2023
Hi Corinna,
I can't update to 3.5+, I tried reinstalling using the Cygwin setup
Using "uname -a", my current version is 3.4.6-1.x86_64.
I assume 3.5 hasn't been released officially.
May I know where to get the test release?
In the terminal, when I use $LC_MONETARY = "en_ZM.utf-8" locale -ck
LC_MONETARY
Cygwin replies "-bash: LC_MONETARY: command not found"
Thank you very much.
Kind Regards,
YEO Kai Wei
On 13/3/2023 6:49 pm, Corinna Vinschen wrote:
> On Mar 13 08:40, Yeo Kai Wei via Cygwin wrote:
>> Hi All,
>>
>> May I ask if there's a bug with Cygwin and Windows currency?
> The en_ZM locale isn't yet supported by Cygwin. This will change with
> Cygwin 3.5.0. You can install the latest Cygwin test release
> 3.5.0-0.231.g93f70d7849b8 and retry. You'll get the correct output:
>
> 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: K International currency symbol: ZMW
>
> Btw., you don't even need a test application, just call
>
> $ LC_MONETARY="en_ZM.utf-8" locale -ck LC_MONETARY
>
>> The correct answer should be "Region: en_ZM.utf-8 Currency symbol: K
>> International currency symbol: ZMK"
>>
>> Supposedly, the code works on Linux.
>>
>> Is this an issue with Windows?
> We're fetching most locale information from Windows, this includes the
> LC_MONETARY information. However, the locale support up to Cygwin 3.4.x
> is restricted by an issue in Windows:
>
> Originally, locales were handled in Windows by using so called locale
> identifiers, LCID, 2 byte numbers. These LCIDs are used by Cygwin
> internally.
>
> In the meantime, Windows switched from LCIDs to locale string
> identifiers following RFC 4646 resp. RFC 5646. Now, the problem is this:
>
> Cygwin didn't yet follow suite, still using LCIDs internally, but
> Windows introduced locales for which no LCID has ever been assigned.
> Asking for the LCID for "en-ZW" returns 0.
>
> For Cygwin 3.5.0, I converted Cygwin to use RFC 5646 locale strings
> internally, too, so the next major version of Cygwin will be able to
> support all locales Windows supports.
>
>> while (regions[i])
>> {
>> setlocale(LC_MONETARY, regions[i]);
> You're not checking for errors here. If the locale isn't supported,
> setlocale should return NULL...
>
>> const struct lconv* loc = localeconv();
> ...and the locale information stays unchanged. As such, if en_ZM isn't
> supported, this call will still fetch the information of the en_NZ.utf-8
> locale.
>
>
> HTH,
> Corinna
More information about the Cygwin
mailing list