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

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

Reply via email to