1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2012 Maxime DOYEN
4 * This file is part of HomeBank.
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "hb-currency.h"
24 #include <libsoup/soup.h>
30 /****************************************************************************/
32 /****************************************************************************/
42 /* our global datas */
43 extern struct HomeBank
*GLOBALS
;
44 extern struct Preferences
*PREFS
;
46 extern Currency4217 iso4217cur
[];
47 extern guint n_iso4217cur
;
49 Currency4217
*iso4217format_get(gchar
*code
);
51 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
54 da_cur_free(Currency
*item
)
56 DB( g_print("da_cur_free\n") );
59 DB( g_print(" => %d, %s\n", item
->key
, item
->iso_code
) );
62 g_free(item
->iso_code
);
64 g_free(item
->decimal_char
);
65 g_free(item
->grouping_char
);
75 DB( g_print("da_cur_malloc\n") );
76 return g_malloc0(sizeof(Currency
));
83 DB( g_print("da_cur_destroy\n") );
84 g_hash_table_destroy(GLOBALS
->h_cur
);
92 DB( g_print("da_cur_new\n") );
93 GLOBALS
->h_cur
= g_hash_table_new_full(g_int_hash
, g_int_equal
, (GDestroyNotify
)g_free
, (GDestroyNotify
)da_cur_free
);
95 // insert default base currency
96 curfmt
= iso4217format_get(PREFS
->IntCurrSymbol
);
98 curfmt
= iso4217format_get("USD");
102 DB( g_printf("curfmt %p\n", curfmt
) );
104 currency_add_from_user(curfmt
);
109 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
110 static void da_cur_max_key_ghfunc(gpointer key
, Currency
*item
, guint32
*max_key
)
112 *max_key
= MAX(*max_key
, item
->key
);
115 static gboolean
da_cur_iso_grfunc(gpointer key
, Currency
*item
, gchar
*iso
)
117 if( iso
&& item
->iso_code
)
119 if(!strcasecmp(iso
, item
->iso_code
))
128 return g_hash_table_size(GLOBALS
->h_cur
);
132 da_cur_remove(guint32 key
)
134 DB( g_print("da_cur_remove %d\n", key
) );
136 return g_hash_table_remove(GLOBALS
->h_cur
, &key
);
141 da_cur_init_from4217(Currency
*cur
, Currency4217
*curfmt
)
143 cur
->symbol
= g_strdup(curfmt
->curr_symbol
);
144 cur
->sym_prefix
= curfmt
->curr_is_prefix
;
145 cur
->decimal_char
= g_strdup(curfmt
->curr_dec_char
);
146 cur
->grouping_char
= g_strdup(curfmt
->curr_grp_char
);
147 cur
->frac_digits
= curfmt
->curr_frac_digit
;
148 da_cur_initformat(cur
);
153 da_cur_initformat(Currency
*item
)
155 DB( g_print("init currency %s, %d \n", item
->symbol
, item
->frac_digits
) );
158 g_snprintf(item
->format
, 8-1, "%%.%df", item
->frac_digits
);
160 if(item
->sym_prefix
== TRUE
)
161 g_snprintf(item
->monfmt
, 32-1, "%s %%s", item
->symbol
);
163 g_snprintf(item
->monfmt
, 32-1, "%%s %s", item
->symbol
);
165 DB( g_print("fmt '%s'\n", item
->format
) );
166 DB( g_print("monfmt '%s'\n", item
->monfmt
) );
171 da_cur_insert(Currency
*item
)
175 DB( g_print("da_cur_insert\n") );
177 new_key
= g_new0(guint32
, 1);
178 *new_key
= item
->key
;
179 g_hash_table_insert(GLOBALS
->h_cur
, new_key
, item
);
181 da_cur_initformat(item
);
188 da_cur_append(Currency
*item
)
193 DB( g_print("da_cur_append\n") );
195 /* ensure no duplicate */
196 //g_strstrip(item->name);
197 if(item
->iso_code
!= NULL
)
199 existitem
= da_cur_get_by_iso_code( item
->iso_code
);
200 if( existitem
== NULL
)
202 new_key
= g_new0(guint32
, 1);
203 *new_key
= da_cur_get_max_key() + 1;
204 item
->key
= *new_key
;
205 //item->pos = da_cur_length() + 1;
207 DB( g_print(" -> insert id: %d\n", *new_key
) );
209 g_hash_table_insert(GLOBALS
->h_cur
, new_key
, item
);
211 da_cur_initformat(item
);
219 DB( g_print(" -> %s already exist: %d\n", item
->iso_code
, item
->key
) );
226 da_cur_get_max_key(void)
230 g_hash_table_foreach(GLOBALS
->h_cur
, (GHFunc
)da_cur_max_key_ghfunc
, &max_key
);
237 da_cur_get_by_iso_code(gchar
*iso_code
)
239 DB( g_print("da_cur_get_by_iso_code\n") );
241 return g_hash_table_find(GLOBALS
->h_cur
, (GHRFunc
)da_cur_iso_grfunc
, iso_code
);
245 da_cur_get(guint32 key
)
247 //DB( g_print("da_cur_get\n") );
249 return g_hash_table_lookup(GLOBALS
->h_cur
, &key
);
256 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
261 * controls if a currency is used [base or account]
263 * Return value: TRUE if used, FALSE, otherwise
266 currency_is_used(guint32 key
)
271 if(GLOBALS
->kcur
== key
)
276 list
= g_hash_table_get_values(GLOBALS
->h_acc
);
279 Account
*item
= list
->data
;
281 if(item
->kcur
== key
)
286 list
= g_list_next(list
);
297 Currency4217
*iso4217format_get(gchar
*code
)
302 for (i
= 0; i
< n_iso4217cur
; i
++)
304 cur
= &iso4217cur
[i
];
305 if(g_strcmp0(cur
->curr_iso_code
, code
) == 0)
314 static void currency_get_system_format(Currency
*item
)
316 DB( g_printf("\n[(currency] get format from system '%s'\n", item
->iso_code
) );
321 struct lconv
*lc
= localeconv();
323 DB( g_print("int_curr_symbol '%s'\n", lc
->int_curr_symbol
) );
325 DB( g_print("mon_decimal_point is utf8: %d\n", g_utf8_validate(lc
->mon_decimal_point
, -1, NULL
)) );
326 DB( g_print("mon_decimal_point '%s'\n", lc
->mon_decimal_point
) );
327 DB( g_print("mon_decimal_point %x %x %x %x\n", lc
->mon_decimal_point
[0], lc
->mon_decimal_point
[1], lc
->mon_decimal_point
[2], lc
->mon_decimal_point
[3]) );
329 DB( g_print("mon_thousands_sep is utf8: %d\n", g_utf8_validate(lc
->mon_thousands_sep
, -1, NULL
)) );
330 DB( g_print("mon_thousands_sep '%s'\n", lc
->mon_thousands_sep
) );
331 DB( g_print("mon_thousands_sep %x %x %x %x\n", lc
->mon_thousands_sep
[0], lc
->mon_thousands_sep
[1], lc
->mon_thousands_sep
[2], lc
->mon_thousands_sep
[3]) );
334 DB( g_print("frac_digits '%d'\n", (gint
)lc
->frac_digits
) );
336 DB( g_print("currency_symbol '%s'\n", lc
->currency_symbol
) );
338 DB( g_print("p_cs_precedes '%d'\n", lc
->p_cs_precedes
) );
340 DB( g_print("n_cs_precedes '%d'\n", lc
->n_cs_precedes
) );
343 item
->symbol
= g_strdup(lc
->currency_symbol
);
345 if( lc
->p_cs_precedes
|| lc
->n_cs_precedes
)
347 item
->sym_prefix
= TRUE
;
348 DB( g_print("locale mon cs is a prefix\n") );
352 item
->sym_prefix
= FALSE
;
355 item
->decimal_char
= g_strdup(lc
->mon_decimal_point
);
357 item
->grouping_char
= g_strdup(lc
->mon_thousands_sep
);
360 //PREFS->base_cur.grouping_char = g_locale_to_utf8(lc->mon_thousands_sep, -1, NULL, NULL, NULL);
361 //PREFS->base_cur.grouping_char = g_convert (lc->mon_thousands_sep, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
363 DB( g_print(" -> grouping_char: '%s'\n", item
->grouping_char
) );
365 item
->frac_digits
= lc
->frac_digits
;
368 if( item
->frac_digits
> MAX_FRAC_DIGIT
)
370 item
->frac_digits
= 2;
371 g_free(item
->decimal_char
);
372 item
->decimal_char
= g_strdup(".");
377 #define BUFFER_SIZE 512
378 char buffer
[BUFFER_SIZE
];
379 //LPWSTR wcBuffer = buffer;
380 LPSTR wcBuffer
= buffer
;
383 //https://msdn.microsoft.com/en-us/library/windows/desktop/dd464799%28v=vs.85%29.aspx
385 //see g_locale_to_utf8 here
386 iResult
= GetLocaleInfoA(LOCALE_USER_DEFAULT
, LOCALE_SCURRENCY
, wcBuffer
, BUFFER_SIZE
);
389 DB( g_print("LOCALE_SCURRENCY='%s'\n", buffer
) );
390 item
->symbol
= g_locale_to_utf8(buffer
, -1, NULL
, NULL
, NULL
);
393 item
->sym_prefix
= FALSE
;
394 iResult
= GetLocaleInfoA(LOCALE_USER_DEFAULT
, LOCALE_IPOSSYMPRECEDES
, wcBuffer
, BUFFER_SIZE
);
397 DB( g_print("LOCALE_IPOSSYMPRECEDES='%s'\n", buffer
) );
398 //todo item->sym_prefix
402 iResult
= GetLocaleInfoA(LOCALE_USER_DEFAULT
, LOCALE_SDECIMAL
, wcBuffer
, BUFFER_SIZE
);
405 DB( g_print("LOCALE_SDECIMAL='%s'\n", buffer
) );
406 item
->decimal_char
= g_locale_to_utf8(buffer
, -1, NULL
, NULL
, NULL
);
409 iResult
= GetLocaleInfoA(LOCALE_USER_DEFAULT
, LOCALE_STHOUSAND
, wcBuffer
, BUFFER_SIZE
);
412 DB( g_print("LOCALE_STHOUSAND='%s'\n", buffer
) );
413 item
->grouping_char
= g_locale_to_utf8(buffer
, -1, NULL
, NULL
, NULL
);
416 iResult
= GetLocaleInfoA(LOCALE_USER_DEFAULT
, LOCALE_ICURRDIGITS
, wcBuffer
, BUFFER_SIZE
);
419 DB( g_print("LOCALE_ICURRDIGITS='%s'\n", buffer
) );
420 item
->frac_digits
= atoi(buffer
);
423 item
->frac_digits
= 2;
432 Currency
*currency_add_from_user(Currency4217
*curfmt
)
436 DB( g_printf("\n[(currency] found adding %s\n", curfmt
->curr_iso_code
) );
438 //item = da_cur_get_by_iso_code(curfmt->curr_iso_code);
440 item
= da_cur_malloc();
445 item
->name
= g_strdup(curfmt
->name
);
446 //item->country = cur.country_name;
447 item
->iso_code
= g_strdup(curfmt
->curr_iso_code
);
449 //1634615 if the currency match the system, fill with it
450 if(!strcmp(item
->iso_code
, PREFS
->IntCurrSymbol
))
452 currency_get_system_format(item
);
456 item
->frac_digits
= curfmt
->curr_frac_digit
;
457 item
->symbol
= g_strdup(curfmt
->curr_symbol
);
458 item
->sym_prefix
= curfmt
->curr_is_prefix
;
459 item
->decimal_char
= g_strdup(curfmt
->curr_dec_char
);
460 item
->grouping_char
= g_strdup(curfmt
->curr_grp_char
);
465 item
->name
= g_strdup("unknow");
466 //item->country = cur.country_name;
467 item
->iso_code
= g_strdup("XXX");
468 item
->frac_digits
= 2;
469 item
->symbol
= g_strdup("XXX");
470 item
->sym_prefix
= FALSE
;
471 item
->decimal_char
= g_strdup(".");
472 item
->grouping_char
= NULL
;
485 start_element_handler (GMarkupParseContext
*context
, const gchar
*element_name
, const gchar
**attribute_names
,
486 const gchar
**attribute_values
, gpointer user_data
, GError
**error
)
488 ParseExchangeContext
*ctx
= user_data
;
491 //DB( g_print("** start element: '%s' iso=%s\n", element_name, ctx->iso) );
493 ctx
->elt_name
= element_name
;
495 switch(element_name
[0])
499 if(!strcmp (element_name
, "rate"))
502 //DB( g_print(" att='%s' val='%s'\n", attribute_names[i], attribute_values[i]) );
503 //we have only 1 attribute id :: store isocode pair
504 if(attribute_names
[i
] != NULL
&& !strcmp (attribute_names
[i
], "id"))
506 g_stpcpy (ctx
->iso
, attribute_values
[i
]);
516 text_handler(GMarkupParseContext
*context
, const gchar
*text
, gsize text_len
, gpointer user_data
, GError
**error
)
518 ParseExchangeContext
*ctx
= user_data
;
523 //DB( g_print("** text: '%s' %d\n", text, text_len) );
525 if(!strcmp (ctx
->elt_name
, "Rate"))
527 ctx
->rate
= g_ascii_strtod(text
, NULL
);
528 //DB( g_print(" stored '%s' %.2f\n", text, ctx->rate) );
534 end_element_handler (GMarkupParseContext
*context
, const gchar
*element_name
, gpointer user_data
, GError
**error
)
536 ParseExchangeContext
*ctx
= user_data
;
539 DB( g_print("** end element: '%s'\n", element_name
) );
541 if(!strcmp (element_name
, "rate"))
543 DB( g_print(" should store here !!\n") );
544 DB( g_print(" %s %f\n", ctx
->iso
, ctx
->rate
) );
545 cur
= da_cur_get_by_iso_code (ctx
->iso
+ 3);
548 DB( g_print(" found cur='%s'\n", cur
->iso_code
) );
549 cur
->rate
= ctx
->rate
;
550 cur
->mdate
= GLOBALS
->today
;
554 ctx
->elt_name
= NULL
;
561 static GMarkupParser hb_xchange_parser
= {
562 start_element_handler
,
570 static gboolean
currency_online_parse(const gchar
*buffer
, GError
**error
)
572 GMarkupParseContext
*context
;
573 ParseExchangeContext ctx
;
576 memset(&ctx
, 0, sizeof(ParseExchangeContext
));
577 context
= g_markup_parse_context_new (&hb_xchange_parser
, 0, &ctx
, NULL
);
579 retval
= g_markup_parse_context_parse (context
, buffer
, -1, error
);
580 //retval = g_markup_parse_context_parse (context, badyahooxml, -1, error);
581 g_markup_parse_context_free (context
);
587 static gchar
*currency_get_query(void)
595 //http://query.yahooapis.com/v1/public/yql
596 //?q=select * from yahoo.finance.xchange where pair in ("EURGBP","EURUSD")
597 //&env=store://datatables.org/alltableswithkeys
599 node
= g_string_sized_new(1024);
600 g_string_append(node
, "http://query.yahooapis.com/v1/public/yql");
601 g_string_append(node
, "?q=select * from yahoo.finance.xchange where pair in (");
603 base
= da_cur_get (GLOBALS
->kcur
);
605 list
= g_hash_table_get_values(GLOBALS
->h_cur
);
606 i
= g_list_length (list
) - 1;
612 if(item
->key
!= GLOBALS
->kcur
)
614 g_string_append_printf(node
, "\"%s%s\"", base
->iso_code
, item
->iso_code
);
617 g_string_append(node
, ",");
621 list
= g_list_next(list
);
625 g_string_append(node
, ")&env=store://datatables.org/alltableswithkeys");
627 return g_string_free(node
, FALSE
);
631 gboolean
currency_sync_online(GError
**error
)
633 SoupSession
*session
;
636 gboolean retval
= TRUE
;
638 DB( g_printf("\n[currency] sync online\n") );
640 query
= currency_get_query();
641 DB( g_printf(" - query is '%s'\n", query
) );
643 session
= soup_session_new ();
644 msg
= soup_message_new ("GET", query
);
647 soup_session_send_message (session
, msg
);
648 DB( g_print("status_code: %d %d\n", msg
->status_code
, SOUP_STATUS_IS_SUCCESSFUL(msg
->status_code
) ) );
649 DB( g_print("reason: %s\n", msg
->reason_phrase
) );
650 DB( g_print("datas: %s\n", msg
->response_body
->data
) );
652 if( SOUP_STATUS_IS_SUCCESSFUL(msg
->status_code
) == TRUE
)
654 retval
= currency_online_parse(msg
->response_body
->data
, error
);
658 *error
= g_error_new_literal(1, msg
->status_code
, msg
->reason_phrase
);
664 *error
= g_error_new_literal(1, 0, "cannot parse URI");
674 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
678 //struct iso_4217_currency iso_4217_currencies[];
681 static void fill_currency(void)
684 struct iso_4217_currency cur;
687 for (i = 0; i< 500; i++)
689 cur = iso_4217_currencies[i];
691 if(cur.iso_code == NULL)
694 item = da_cur_malloc();
697 item->name = cur.currency;
698 item->country = cur.country;
699 item->iso_code = cur.iso_code;
709 Currency4217 iso4217cur
[] =
711 { "AED", 2, ".", ",", TRUE
, "د.إ.", "UAE Dirham" },
712 { "AFN", 0, ",", ",", TRUE
, "؋", "Afghani" },
713 { "ALL", 0, ",", " ", FALSE
, "Lekë", "Lek" },
714 { "AMD", 2, ".", ",", FALSE
, "֏", "Armenian Dram" },
715 { "ANG", 2, ",", ",", TRUE
, "NAf.", "Netherlands Antillian Guilder" },
716 { "AOA", 2, ",", " ", FALSE
, "Kz", "Kwanza" },
717 { "ARS", 2, ",", ".", TRUE
, "$", "Argentine Peso" },
718 { "AUD", 2, ".", ",", TRUE
, "$", "Australian Dollar" },
719 { "AWG", 2, ",", ".", TRUE
, "Afl.", "Aruban Guilder" },
720 { "AZN", 2, ",", " ", TRUE
, "₼", "Azerbaijanian Manat" },
721 { "BAM", 2, ",", ".", FALSE
, "KM", "Convertible Marks" },
722 { "BBD", 2, ".", ",", TRUE
, "$", "Barbados Dollar" },
723 { "BDT", 2, ".", ",", TRUE
, "৳", "Taka" },
724 { "BGN", 2, ",", " ", FALSE
, "лв.", "Bulgarian Lev" },
725 { "BHD", 3, ".", ",", TRUE
, "د.ب.", "Bahraini Dinar" },
726 { "BIF", 0, ",", " ", FALSE
, "FBu", "Burundi Franc" },
727 { "BMD", 2, ".", ",", TRUE
, "$", "Bermudian Dollar" },
728 { "BND", 2, ",", ".", TRUE
, "$", "Brunei Dollar" },
729 { "BOB", 2, ",", ".", TRUE
, "Bs", "Boliviano" },
730 { "BOV", 2, ".", "", FALSE
, "BOV", "Mvdol" },
731 { "BRL", 2, ",", ".", TRUE
, "R$", "Brazilian Real" },
732 { "BSD", 2, ".", ",", TRUE
, "$", "Bahamian Dollar" },
733 { "BTN", 2, ".", ",", TRUE
, "Nu.", "Ngultrum" },
734 { "BWP", 2, ".", " ", TRUE
, "P", "Pula" },
735 { "BYR", 0, ",", " ", FALSE
, "Br", "Belarussian Ruble" },
736 { "BZD", 2, ".", ",", TRUE
, "$", "Belize Dollar" },
737 { "CAD", 2, ",", " ", TRUE
, "$", "Canadian Dollar" },
738 { "CDF", 2, ",", " ", TRUE
, "FC", "Congolese Franc" },
739 { "CHE", 2, ".", "", FALSE
, "CHE", "WIR Euro" },
740 { "CHF", 2, ",", "'", TRUE
, "CHF", "Swiss Franc" },
741 { "CHW", 2, ".", "", FALSE
, "CHW", "WIR Franc" },
742 { "CLF", 2, ".", "", FALSE
, "CLF", "Unidades de fomento" },
743 { "CLP", 0, ",", ".", TRUE
, "$", "Chilean Peso" },
744 { "CNY", 2, ".", ",", TRUE
, "¥", "Yuan Renminbi" },
745 { "COP", 0, ",", ".", TRUE
, "$", "Colombian Peso" },
746 { "COU", 2, ".", "", FALSE
, "COU", "Unidad de Valor Real" },
747 { "CRC", 0, ",", ".", TRUE
, "₡", "Costa Rican Colon" },
748 { "CUP", 2, ".", ",", TRUE
, "$", "Cuban Peso" },
749 { "CVE", 2, "$", " ", FALSE
, "", "Cape Verde Escudo" },
750 { "CYP", 2, ".", "", FALSE
, "CYP", "Cyprus Pound" },
751 { "CZK", 2, ",", " ", FALSE
, "Kč", "Czech Koruna" },
752 { "DJF", 0, ",", " ", TRUE
, "Fdj", "Djibouti Franc" },
753 { "DKK", 2, ",", ".", TRUE
, "kr", "Danish Krone" },
754 { "DOP", 2, ".", ",", TRUE
, "$", "Dominican Peso" },
755 { "DZD", 2, ",", " ", FALSE
, "DA", "Algerian Dinar" },
756 { "EEK", 2, ".", "", FALSE
, "EEK", "Kroon" },
757 { "EGP", 2, ".", ",", TRUE
, "ج.م.", "Egyptian Pound" },
758 { "ERN", 2, ".", ",", TRUE
, "Nfk", "Nakfa" },
759 { "ETB", 2, ".", ",", TRUE
, "Br", "Ethiopian Birr" },
760 { "EUR", 2, ",", " ", TRUE
, "€", "Euro" },
761 { "FJD", 2, ".", ",", TRUE
, "$", "Fiji Dollar" },
762 { "FKP", 2, ".", ",", TRUE
, "£", "Falkland Islands Pound" },
763 { "GBP", 2, ".", ",", TRUE
, "£", "Pound Sterling" },
764 { "GEL", 2, ",", " ", TRUE
, "₾", "Lari" },
765 { "GHS", 2, ".", ",", TRUE
, "GH₵", "Ghana Cedi" },
766 { "GIP", 2, ".", ",", TRUE
, "£", "Gibraltar Pound" },
767 { "GMD", 2, ".", ",", TRUE
, "D", "Dalasi" },
768 { "GNF", 0, ",", " ", TRUE
, "FG", "Guinea Franc" },
769 { "GTQ", 2, ".", ",", TRUE
, "Q", "Quetzal" },
770 { "GYD", 0, ".", ",", TRUE
, "$", "Guyana Dollar" },
771 { "HKD", 2, ".", ",", TRUE
, "$", "Hong Kong Dollar" },
772 { "HNL", 2, ".", ",", TRUE
, "L", "Lempira" },
773 { "HRK", 2, ",", ".", FALSE
, "kn", "Croatian Kuna" },
774 { "HTG", 2, ",", " ", FALSE
, "G", "Gourde" },
775 { "HUF", 2, ",", " ", FALSE
, "HUF", "Forint" },
776 { "IDR", 0, ",", ".", TRUE
, "Rp", "Rupiah" },
777 { "ILS", 2, ".", ",", TRUE
, "₪", "New Israeli Sheqel" },
778 { "INR", 2, ".", ",", TRUE
, "₹", "Indian Rupee" },
779 { "IQD", 2, ".", ",", TRUE
, "د.ع.", "Iraqi Dinar" },
780 { "IRR", 2, "/", ",", TRUE
, "ريال", "Iranian Rial" },
781 { "ISK", 0, ",", ".", FALSE
, "ISK", "Iceland Krona" },
782 { "JMD", 2, ".", ",", TRUE
, "$", "Jamaican Dollar" },
783 { "JOD", 3, ".", ",", TRUE
, "د.ا.", "Jordanian Dinar" },
784 { "JPY", 0, ".", ",", TRUE
, "¥", "Yen" },
785 { "KES", 2, ".", ",", TRUE
, "Ksh", "Kenyan Shilling" },
786 { "KGS", 2, ",", " ", FALSE
, "сом", "Som" },
787 { "KHR", 2, ".", ",", FALSE
, "៛", "Riel" },
788 { "KMF", 0, ",", " ", TRUE
, "CF", "Comoro Franc" },
789 { "KPW", 2, ".", "", FALSE
, "KPW", "North Korean Won" },
790 { "KRW", 0, ".", ",", TRUE
, "₩", "Won" },
791 { "KWD", 3, ".", ",", TRUE
, "د.ك.", "Kuwaiti Dinar" },
792 { "KYD", 2, ".", ",", TRUE
, "$", "Cayman Islands Dollar" },
793 { "KZT", 2, ",", " ", FALSE
, "₸", "Tenge" },
794 { "LAK", 0, ",", ".", TRUE
, "₭", "Kip" },
795 { "LBP", 2, ".", ",", TRUE
, "ل.ل.", "Lebanese Pound" },
796 { "LKR", 2, ".", ",", TRUE
, "Rs.", "Sri Lanka Rupee" },
797 { "LRD", 2, ".", ",", TRUE
, "$", "Liberian Dollar" },
798 { "LSL", 2, ".", "", FALSE
, "LSL", "Loti" },
799 { "LTL", 2, ".", "", FALSE
, "LTL", "Lithuanian Litas" },
800 { "LVL", 2, ".", "", FALSE
, "LVL", "Latvian Lats" },
801 { "LYD", 3, ".", ",", TRUE
, "د.ل.", "Libyan Dinar" },
802 { "MAD", 2, ",", " ", FALSE
, "DH", "Moroccan Dirham" },
803 { "MDL", 2, ",", " ", FALSE
, "L", "Moldovan Leu" },
804 { "MGA", 0, ",", " ", TRUE
, "Ar", "Malagasy Ariary" },
805 { "MKD", 2, ",", " ", TRUE
, "den", "Denar" },
806 { "MMK", 0, ".", ",", TRUE
, "K", "Kyat" },
807 { "MNT", 0, ".", ",", TRUE
, "₮", "Tugrik" },
808 { "MOP", 2, ",", " ", TRUE
, "MOP", "Pataca" },
809 { "MRO", 0, ",", " ", TRUE
, "UM", "Ouguiya" },
810 { "MTL", 2, ".", "", FALSE
, "MTL", "Maltese Lira" },
811 { "MUR", 0, ",", " ", TRUE
, "Rs", "Mauritius Rupee" },
812 { "MVR", 2, ".", ",", FALSE
, "ރ.", "Rufiyaa" },
813 { "MWK", 2, ".", ",", TRUE
, "MK", "Kwacha" },
814 { "MXN", 2, ".", ",", TRUE
, "$", "Mexican Peso" },
815 { "MXV", 2, ".", "", FALSE
, "MXV", "Mexican Unidad de Inversion (UDI)" },
816 { "MYR", 2, ".", ",", TRUE
, "RM", "Malaysian Ringgit" },
817 { "MZN", 2, ",", " ", FALSE
, "MTn", "Metical" },
818 { "NAD", 2, ",", " ", TRUE
, "$", "Namibia Dollar" },
819 { "NGN", 2, ".", ",", TRUE
, "₦", "Naira" },
820 { "NIO", 2, ".", ",", TRUE
, "C$", "Cordoba Oro" },
821 { "NOK", 2, ",", " ", TRUE
, "kr", "Norwegian Krone" },
822 { "NPR", 2, ".", ",", TRUE
, "रु", "Nepalese Rupee" },
823 { "NZD", 2, ".", ",", TRUE
, "$", "New Zealand Dollar" },
824 { "OMR", 3, ".", ",", TRUE
, "ر.ع.", "Rial Omani" },
825 { "PAB", 2, ".", ",", TRUE
, "B/.", "Balboa" },
826 { "PEN", 2, ".", ",", TRUE
, "S/.", "Nuevo Sol" },
827 { "PGK", 2, ".", ",", TRUE
, "K", "Kina" },
828 { "PHP", 2, ",", ",", TRUE
, "₱", "Philippine Peso" },
829 { "PKR", 0, ".", ",", TRUE
, "Rs", "Pakistan Rupee" },
830 { "PLN", 2, ",", " ", FALSE
, "zł", "Zloty" },
831 { "PYG", 0, ",", ".", TRUE
, "₲", "Guarani" },
832 { "QAR", 2, ".", ",", TRUE
, "ر.ق.", "Qatari Rial" },
833 { "RON", 2, ",", ".", FALSE
, "RON", "New Leu" },
834 { "RSD", 0, ",", ".", FALSE
, "RSD", "Serbian Dinar" },
835 { "RUB", 2, ",", " ", TRUE
, "₽", "Russian Ruble" },
836 { "RWF", 0, ",", " ", TRUE
, "RF", "Rwanda Franc" },
837 { "SAR", 2, ".", ",", TRUE
, "ر.س.", "Saudi Riyal" },
838 { "SBD", 2, ".", ",", TRUE
, "$", "Solomon Islands Dollar" },
839 { "SCR", 2, ",", " ", TRUE
, "SR", "Seychelles Rupee" },
840 { "SDG", 2, ".", ",", TRUE
, "SDG", "Sudanese Pound" },
841 { "SEK", 2, ",", ".", FALSE
, "kr", "Swedish Krona" },
842 { "SGD", 2, ".", ",", TRUE
, "$", "Singapore Dollar" },
843 { "SHP", 2, ".", ",", TRUE
, "£", "Saint Helena Pound" },
844 { "SLL", 0, ".", ",", TRUE
, "Le", "Leone" },
845 { "SOS", 0, ".", ",", TRUE
, "S", "Somali Shilling" },
846 { "SRD", 2, ",", ".", TRUE
, "$", "Surinam Dollar" },
847 { "STD", 0, ",", " ", FALSE
, "Db", "Dobra" },
848 { "SVC", 2, ".", "", FALSE
, "SVC", "El Salvador Colon" },
849 { "SYP", 0, ",", " ", TRUE
, "LS", "Syrian Pound" },
850 { "SZL", 2, ",", " ", TRUE
, "E", "Lilangeni" },
851 { "THB", 2, ".", ",", TRUE
, "฿", "Baht" },
852 { "TJS", 2, ",", " ", FALSE
, "смн", "Somoni" },
853 { "TMM", 2, ".", "", FALSE
, "TMM", "Manat" },
854 { "TND", 3, ",", " ", TRUE
, "DT", "Tunisian Dinar" },
855 { "TOP", 2, ".", ",", TRUE
, "T$", "Pa'anga" },
856 { "TRY", 2, ",", ".", FALSE
, "₺", "New Turkish Lira" },
857 { "TTD", 2, ".", ",", TRUE
, "$", "Trinidad and Tobago Dollar" },
858 { "TWD", 2, ".", ",", TRUE
, "NT$", "New Taiwan Dollar" },
859 { "TZS", 0, ".", ",", TRUE
, "TSh", "Tanzanian Shilling" },
860 { "UAH", 2, ",", " ", FALSE
, "₴", "Hryvnia" },
861 { "UGX", 0, ".", ",", TRUE
, "USh", "Uganda Shilling" },
862 { "USD", 2, ",", " ", TRUE
, "$", "US Dollar" },
863 { "USN", 2, ".", "", FALSE
, "USN", "US Dollar (Next day)" },
864 { "USS", 2, ".", "", FALSE
, "USS", "US Dollar (Same day)" },
865 { "UYI", 2, ".", "", FALSE
, "UYI", "Uruguay Peso en Unidades Indexadas" },
866 { "UYU", 2, ",", ".", TRUE
, "$", "Peso Uruguayo" },
867 { "UZS", 0, ",", " ", TRUE
, "soʻm", "Uzbekistan Sum" },
868 { "VEF", 2, ",", ".", TRUE
, "Bs.", "Bolivar Fuerte" },
869 { "VND", 2, ",", ".", FALSE
, "₫", "Dong" },
870 { "VUV", 0, ",", " ", TRUE
, "VT", "Vatu" },
871 { "WST", 2, ".", ",", TRUE
, "WS$", "Tala" },
872 { "XAF", 0, ",", " ", TRUE
, "FCFA", "CFA Franc BEAC" },
873 { "XAG", 2, ".", "", FALSE
, "XAG", "Silver" },
874 { "XAU", 2, ".", "", FALSE
, "XAU", "Gold" },
875 { "XBA", 2, ".", "", FALSE
, "XBA", "European Composite Unit (EURCO)" },
876 { "XBB", 2, ".", "", FALSE
, "XBB", "European Monetary Unit (E.M.U.-6)" },
877 { "XBC", 2, ".", "", FALSE
, "XBC", "European Unit of Account 9 (E.U.A.-9)" },
878 { "XBD", 2, ".", "", FALSE
, "XBD", "European Unit of Account 17 (E.U.A.-17)" },
879 { "XCD", 2, ",", " ", TRUE
, "$", "East Caribbean Dollar" },
880 { "XDR", 2, ",", " ", TRUE
, "XDR", "Special Drawing Rights" },
881 { "XFO", 2, ".", "", FALSE
, "XFO", "Gold-Franc" },
882 { "XFU", 2, ".", "", FALSE
, "XFU", "UIC-Franc" },
883 { "XOF", 0, ",", " ", TRUE
, "CFA", "CFA Franc BCEAO" },
884 { "XPD", 2, ".", "", FALSE
, "XPD", "Palladium" },
885 { "XPF", 0, ",", " ", FALSE
, "FCFP", "CFP Franc" },
886 { "XPT", 2, ".", "", FALSE
, "XPT", "Platinum" },
887 { "XTS", 2, ".", "", FALSE
, "XTS", "Code for testing purposes" },
888 { "XXX", 2, ".", "", FALSE
, "XXX", "No currency" },
889 { "YER", 2, ".", ",", TRUE
, "ر.ي.", "Yemeni Rial" },
890 { "ZAR", 2, ",", " ", TRUE
, "R", "Rand" },
891 { "ZMK", 2, ".", "", FALSE
, "ZMK", "Zambian Kwacha" },
892 { "ZWD", 2, ".", "", FALSE
, "ZWD", "Zimbabwe Dollar" }
894 guint n_iso4217cur
= G_N_ELEMENTS (iso4217cur
);