public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Yeo Kai Wei <yeokaiwei@hotmail.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: [ERROR] Locale Monetary Symbol Prints Wrongly on Windows : Cygwin
Date: Mon, 13 Mar 2023 08:40:55 +0800	[thread overview]
Message-ID: <PH0PR05MB9918E3261DF25870A4834D3AA4B99@PH0PR05MB9918.namprd05.prod.outlook.com> (raw)

[-- 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++;
     }
}

             reply	other threads:[~2023-03-13  0:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13  0:40 Yeo Kai Wei [this message]
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

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=PH0PR05MB9918E3261DF25870A4834D3AA4B99@PH0PR05MB9918.namprd05.prod.outlook.com \
    --to=yeokaiwei@hotmail.com \
    --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).