public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin
@ 2023-03-13  0:40 Yeo Kai Wei
  2023-03-13  5:40 ` Brian Inglis
  2023-03-13 10:49 ` Corinna Vinschen
  0 siblings, 2 replies; 7+ messages in thread
From: Yeo Kai Wei @ 2023-03-13  0:40 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]

Hi All,

May I ask if there's a bug with Cygwin and Windows currency?

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"

Supposedly, the code works on Linux.

Is this an issue with Windows?

How can one solve this issue?


Thank you very much.


Kind Regards,

YEO Kai Wei


*CODE*

#include <locale.h>

#include <stdio.h>

#include <stdlib.h>

void main()
{
     setlocale(LC_ALL, "");

     char* regions[] = {"en_AU.utf-8",
         "en_CA.utf-8",
         "en_GB.utf-8",
         "en_US.utf-8",
         "en_NZ.utf-8",
         "en_ZM.utf-8",
         NULL};

     int i = 0;

     while (regions[i])
     {
         setlocale(LC_MONETARY, regions[i]);

         const struct lconv* loc = localeconv();

         printf("Region: %s Currency symbol: %s International currency 
symbol: %s\n", regions[i], loc->currency_symbol, loc->int_curr_symbol);

         i++;
     }
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-14 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13  0:40 [ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin Yeo Kai Wei
2023-03-13  5:40 ` Brian Inglis
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

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