]> Dogcows Code - chaz/homebank/blob - src/hb-currency.c
import homebank-5.1.7
[chaz/homebank] / src / hb-currency.c
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2018 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
20
21 #include "homebank.h"
22
23 #include "hb-currency.h"
24 #include <libsoup/soup.h>
25
26 #ifdef G_OS_WIN32
27 #include <windows.h>
28 #endif
29
30 /****************************************************************************/
31 /* Debug macros */
32 /****************************************************************************/
33
34 #define MYDEBUG 0
35
36 #if MYDEBUG
37 #define DB(x) (x);
38 #else
39 #define DB(x);
40 #endif
41
42 /* our global datas */
43 extern struct HomeBank *GLOBALS;
44 extern struct Preferences *PREFS;
45
46 extern Currency4217 iso4217cur[];
47 extern guint n_iso4217cur;
48
49
50 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
51
52 void
53 da_cur_free(Currency *item)
54 {
55 DB( g_print("da_cur_free\n") );
56 if(item != NULL)
57 {
58 DB( g_print(" => %d, %s\n", item->key, item->iso_code) );
59
60 g_free(item->name);
61 g_free(item->iso_code);
62 g_free(item->symbol);
63 g_free(item->decimal_char);
64 g_free(item->grouping_char);
65
66 g_free(item);
67 }
68 }
69
70
71 Currency *
72 da_cur_malloc(void)
73 {
74 DB( g_print("da_cur_malloc\n") );
75 return g_malloc0(sizeof(Currency));
76 }
77
78
79 void
80 da_cur_destroy(void)
81 {
82 DB( g_print("da_cur_destroy\n") );
83 g_hash_table_destroy(GLOBALS->h_cur);
84 }
85
86 void
87 da_cur_new(void)
88 {
89 Currency4217 *curfmt;
90
91 DB( g_print("da_cur_new\n") );
92 GLOBALS->h_cur = g_hash_table_new_full(g_int_hash, g_int_equal, (GDestroyNotify)g_free, (GDestroyNotify)da_cur_free);
93
94 // insert default base currency
95 curfmt = iso4217format_get(PREFS->IntCurrSymbol);
96 if(curfmt == NULL)
97 curfmt = iso4217format_get("USD");
98
99 if(curfmt)
100 {
101 DB( g_printf("curfmt %p\n", curfmt) );
102
103 currency_add_from_user(curfmt);
104 }
105 }
106
107
108 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
109 static void da_cur_max_key_ghfunc(gpointer key, Currency *item, guint32 *max_key)
110 {
111 *max_key = MAX(*max_key, item->key);
112 }
113
114 static gboolean da_cur_name_grfunc(gpointer key, Currency *item, gchar *name)
115 {
116 if( name && item->name )
117 {
118 if(!strcasecmp(name, item->name))
119 return TRUE;
120 }
121 return FALSE;
122 }
123
124 static gboolean da_cur_iso_grfunc(gpointer key, Currency *item, gchar *iso)
125 {
126 if( iso && item->iso_code )
127 {
128 if(!strcasecmp(iso, item->iso_code))
129 return TRUE;
130 }
131 return FALSE;
132 }
133
134 guint
135 da_cur_length(void)
136 {
137 return g_hash_table_size(GLOBALS->h_cur);
138 }
139
140 gboolean
141 da_cur_remove(guint32 key)
142 {
143 DB( g_print("da_cur_remove %d\n", key) );
144
145 return g_hash_table_remove(GLOBALS->h_cur, &key);
146 }
147
148
149 void
150 da_cur_init_from4217(Currency *cur, Currency4217 *curfmt)
151 {
152 cur->symbol = g_strdup(curfmt->curr_symbol);
153 cur->sym_prefix = curfmt->curr_is_prefix;
154 cur->decimal_char = g_strdup(curfmt->curr_dec_char);
155 cur->grouping_char = g_strdup(curfmt->curr_grp_char);
156 cur->frac_digits = curfmt->curr_frac_digit;
157 da_cur_initformat(cur);
158 }
159
160
161 void
162 da_cur_initformat(Currency *item)
163 {
164 DB( g_print("init currency %s, %d \n", item->symbol, item->frac_digits) );
165
166 // for formatd
167 g_snprintf(item->format , 8-1, "%%.%df", item->frac_digits);
168
169 if(item->sym_prefix == TRUE)
170 g_snprintf(item->monfmt , 32-1, "%s %%s", item->symbol);
171 else
172 g_snprintf(item->monfmt , 32-1, "%%s %s", item->symbol);
173
174 DB( g_print("fmt '%s'\n", item->format) );
175 DB( g_print("monfmt '%s'\n", item->monfmt) );
176 }
177
178
179 gboolean
180 da_cur_insert(Currency *item)
181 {
182 guint32 *new_key;
183
184 DB( g_print("da_cur_insert\n") );
185
186 new_key = g_new0(guint32, 1);
187 *new_key = item->key;
188 g_hash_table_insert(GLOBALS->h_cur, new_key, item);
189
190 da_cur_initformat(item);
191
192 return TRUE;
193 }
194
195
196 gboolean
197 da_cur_append(Currency *item)
198 {
199 Currency *existitem;
200 guint32 *new_key;
201
202 DB( g_print("da_cur_append\n") );
203
204 /* ensure no duplicate */
205 existitem = da_cur_get_by_name( item->name );
206 if( existitem == NULL )
207 {
208 new_key = g_new0(guint32, 1);
209 *new_key = da_cur_get_max_key() + 1;
210 item->key = *new_key;
211 //item->pos = da_cur_length() + 1;
212
213 DB( g_print(" -> insert id: %d\n", *new_key) );
214
215 g_hash_table_insert(GLOBALS->h_cur, new_key, item);
216
217 da_cur_initformat(item);
218
219 return TRUE;
220 }
221
222 DB( g_print(" -> %s already exist: %d\n", item->iso_code, item->key) );
223
224 return FALSE;
225 }
226
227
228 guint32
229 da_cur_get_max_key(void)
230 {
231 guint32 max_key = 0;
232
233 g_hash_table_foreach(GLOBALS->h_cur, (GHFunc)da_cur_max_key_ghfunc, &max_key);
234 return max_key;
235 }
236
237
238 Currency *
239 da_cur_get_by_name(gchar *name)
240 {
241 DB( g_print("da_cur_get_by_name\n") );
242
243 return g_hash_table_find(GLOBALS->h_cur, (GHRFunc)da_cur_name_grfunc, name);
244 }
245
246
247 Currency *
248 da_cur_get_by_iso_code(gchar *iso_code)
249 {
250 DB( g_print("da_cur_get_by_iso_code\n") );
251
252 return g_hash_table_find(GLOBALS->h_cur, (GHRFunc)da_cur_iso_grfunc, iso_code);
253 }
254
255 Currency *
256 da_cur_get(guint32 key)
257 {
258 //DB( g_print("da_cur_get\n") );
259
260 return g_hash_table_lookup(GLOBALS->h_cur, &key);
261 }
262
263
264
265
266
267 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
268
269 /**
270 * currency_is_used:
271 *
272 * controls if a currency is used [base or account]
273 *
274 * Return value: TRUE if used, FALSE, otherwise
275 */
276 gboolean
277 currency_is_used(guint32 key)
278 {
279 GList *list;
280 gboolean retval;
281
282 if(GLOBALS->kcur == key)
283 return TRUE;
284
285 retval = FALSE;
286
287 list = g_hash_table_get_values(GLOBALS->h_acc);
288 while (list != NULL)
289 {
290 Account *item = list->data;
291
292 if(item->kcur == key)
293 {
294 retval = TRUE;
295 goto end;
296 }
297 list = g_list_next(list);
298 }
299
300 end:
301 g_list_free(list);
302
303 return retval;
304 }
305
306
307
308 Currency4217 *iso4217format_get(gchar *code)
309 {
310 Currency4217 *cur;
311 guint i;
312
313 for (i = 0; i< n_iso4217cur; i++)
314 {
315 cur = &iso4217cur[i];
316 if(g_strcmp0(cur->curr_iso_code, code) == 0)
317 {
318 return cur;
319 }
320 }
321 return NULL;
322 }
323
324
325 static void currency_get_system_format(Currency *item)
326 {
327 DB( g_printf("\n[(currency] get format from system '%s'\n", item->iso_code) );
328
329
330 #ifdef G_OS_UNIX
331
332 struct lconv *lc = localeconv();
333
334 DB( g_print("int_curr_symbol '%s'\n", lc->int_curr_symbol) );
335
336 DB( g_print("mon_decimal_point is utf8: %d\n", g_utf8_validate(lc->mon_decimal_point, -1, NULL)) );
337 DB( g_print("mon_decimal_point '%s'\n", lc->mon_decimal_point) );
338 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]) );
339
340 DB( g_print("mon_thousands_sep is utf8: %d\n", g_utf8_validate(lc->mon_thousands_sep, -1, NULL)) );
341 DB( g_print("mon_thousands_sep '%s'\n", lc->mon_thousands_sep) );
342 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]) );
343
344
345 DB( g_print("frac_digits '%d'\n", (gint)lc->frac_digits) );
346
347 DB( g_print("currency_symbol '%s'\n", lc->currency_symbol) );
348
349 DB( g_print("p_cs_precedes '%d'\n", lc->p_cs_precedes) );
350
351 DB( g_print("n_cs_precedes '%d'\n", lc->n_cs_precedes) );
352
353 /* ok assign */
354 item->symbol = g_strdup(lc->currency_symbol);
355
356 if( lc->p_cs_precedes || lc->n_cs_precedes )
357 {
358 item->sym_prefix = TRUE;
359 DB( g_print("locale mon cs is a prefix\n") );
360 }
361 else
362 {
363 item->sym_prefix = FALSE;
364 }
365
366 item->decimal_char = g_strdup(lc->mon_decimal_point);
367
368 item->grouping_char = g_strdup(lc->mon_thousands_sep);
369
370 //todo:fix
371 //PREFS->base_cur.grouping_char = g_locale_to_utf8(lc->mon_thousands_sep, -1, NULL, NULL, NULL);
372 //PREFS->base_cur.grouping_char = g_convert (lc->mon_thousands_sep, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
373
374 DB( g_print(" -> grouping_char: '%s'\n", item->grouping_char) );
375
376 item->frac_digits = lc->frac_digits;
377
378 //fix 378992/421228
379 if( item->frac_digits > MAX_FRAC_DIGIT )
380 {
381 item->frac_digits = 2;
382 g_free(item->decimal_char);
383 item->decimal_char = g_strdup(".");
384 }
385
386 #else
387 #ifdef G_OS_WIN32
388 #define BUFFER_SIZE 512
389 char buffer[BUFFER_SIZE];
390 //LPWSTR wcBuffer = buffer;
391 LPSTR wcBuffer = buffer;
392 int iResult;
393
394 //https://msdn.microsoft.com/en-us/library/windows/desktop/dd464799%28v=vs.85%29.aspx
395
396 //see g_locale_to_utf8 here
397 iResult = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, wcBuffer, BUFFER_SIZE);
398 if(iResult > 0)
399 {
400 DB( g_print("LOCALE_SCURRENCY='%s'\n", buffer) );
401 item->symbol = g_locale_to_utf8(buffer, -1, NULL, NULL, NULL);
402 }
403
404 item->sym_prefix = FALSE;
405 iResult = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IPOSSYMPRECEDES, wcBuffer, BUFFER_SIZE);
406 if(iResult > 0)
407 {
408 DB( g_print("LOCALE_IPOSSYMPRECEDES='%s'\n", buffer) );
409 //todo item->sym_prefix
410
411 }
412
413 iResult = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wcBuffer, BUFFER_SIZE);
414 if(iResult > 0)
415 {
416 DB( g_print("LOCALE_SDECIMAL='%s'\n", buffer) );
417 item->decimal_char = g_locale_to_utf8(buffer, -1, NULL, NULL, NULL);
418 }
419
420 iResult = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wcBuffer, BUFFER_SIZE);
421 if(iResult > 0)
422 {
423 DB( g_print("LOCALE_STHOUSAND='%s'\n", buffer) );
424 item->grouping_char = g_locale_to_utf8(buffer, -1, NULL, NULL, NULL);
425 }
426
427 iResult = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS, wcBuffer, BUFFER_SIZE);
428 if(iResult > 0)
429 {
430 DB( g_print("LOCALE_ICURRDIGITS='%s'\n", buffer) );
431 item->frac_digits = atoi(buffer);
432 }
433 else
434 item->frac_digits = 2;
435
436 #endif
437 #endif
438
439
440 }
441
442
443 Currency *currency_add_from_user(Currency4217 *curfmt)
444 {
445 Currency *item;
446
447 DB( g_printf("\n[(currency] found adding %s\n", curfmt->curr_iso_code) );
448
449 item = da_cur_malloc();
450 //no mem alloc here
451 //item->key = i;
452 if(curfmt != NULL)
453 {
454 item->name = g_strdup(curfmt->name);
455 //item->country = cur.country_name;
456 item->iso_code = g_strdup(curfmt->curr_iso_code);
457
458 //1634615 if the currency match the system, fill with it
459 if(!strcmp(item->iso_code, PREFS->IntCurrSymbol))
460 {
461 currency_get_system_format(item);
462 }
463 else
464 {
465 item->frac_digits = curfmt->curr_frac_digit;
466 item->symbol = g_strdup(curfmt->curr_symbol);
467 item->sym_prefix = curfmt->curr_is_prefix;
468 item->decimal_char = g_strdup(curfmt->curr_dec_char);
469 item->grouping_char = g_strdup(curfmt->curr_grp_char);
470 }
471 }
472 else
473 {
474 item->name = g_strdup("unknow");
475 //item->country = cur.country_name;
476 item->iso_code = g_strdup("XXX");
477 item->frac_digits = 2;
478 item->symbol = g_strdup("XXX");
479 item->sym_prefix = FALSE;
480 item->decimal_char = g_strdup(".");
481 item->grouping_char = NULL;
482 }
483
484 da_cur_append(item);
485
486 return item;
487 }
488
489
490 static gboolean currency_rate_update(gchar *isocode, gdouble rate, guint32 date)
491 {
492 gboolean retval = FALSE;
493 Currency *cur;
494
495 cur = da_cur_get_by_iso_code (isocode);
496 if(cur)
497 {
498 DB( g_print(" found cur='%s'\n", cur->iso_code) );
499 cur->rate = rate;
500 cur->mdate = date;
501 GLOBALS->changes_count++;
502 retval = TRUE;
503 }
504
505 return retval;
506 }
507
508
509 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
510
511
512 /*
513 //test API
514 gchar fixeriojson[] =
515 "{    }";
516 " { \r \"base\" : \"EUR\", \
517 \"date\": \n\r \"2017-12-04\", \
518 \"rates\" \n\n :{\"AUD\":1.5585,\"CAD\":1.5034,\"CHF\":1.1665,\"CNY\":7.8532,\"GBP\":0.87725,\"JPY\":133.91,\"USD\":1.1865 \
519 } }";
520 */
521
522
523 static gboolean api_fixerio_parse(const gchar *body, GError **error)
524 {
525 gchar *rawjson;
526 gchar *p;
527 gchar strbuf[48];
528 gchar isocode[8];
529 gdouble rate;
530 guint32 date = GLOBALS->today;
531 guint count = 0;
532
533 if(body)
534 {
535 //there is no need of a complex JSON parser here, so let's hack !
536 rawjson = g_strdup(body);
537 hb_string_inline(rawjson);
538
539 DB( g_printf("\nbody: '%s'\n", rawjson ) );
540
541 //get date
542 p = g_strstr_len(rawjson, -1, "\"date\"");
543 if(p)
544 {
545 strncpy(strbuf, p+8, 10);
546 strbuf[10]='\0';
547 date = hb_date_get_julian(strbuf, PRF_DATEFMT_YMD);
548 DB( g_printf("\n-date: %.10s %d\n", strbuf, date) );
549 }
550
551 //get rates
552 p = g_strstr_len(rawjson, -1, "\"rates\"");
553 if(p)
554 {
555 p = p+8;
556 do
557 {
558 p = hb_string_copy_jsonpair(strbuf, p);
559 strncpy(isocode, strbuf, 3);
560 isocode[3]='\0';
561 rate = g_ascii_strtod(strbuf+4, NULL);
562 DB( g_printf("\npair: '%s' '%s' %f\n", strbuf, isocode, rate ) );
563
564 if( currency_rate_update(isocode, rate, date) )
565 count++;
566 }
567 while( p != NULL );
568 }
569
570 g_free(rawjson);
571
572 }
573
574 return( (count > 0) ? TRUE : FALSE);
575 }
576
577
578 static gchar *api_fixerio_query_build(void)
579 {
580 GList *list;
581 GString *node;
582 Currency *base;
583 Currency *item;
584 gint i;
585
586 base = da_cur_get (GLOBALS->kcur);
587
588 node = g_string_sized_new(512);
589 g_string_append_printf(node, "https://api.fixer.io/latest?base=%s&symbols=", base->iso_code);
590
591 list = g_hash_table_get_values(GLOBALS->h_cur);
592 i = g_list_length (list);
593 while (list != NULL)
594 {
595 item = list->data;
596
597 if( (item->key != GLOBALS->kcur) && (strlen(item->iso_code) == 3) )
598 {
599 g_string_append_printf(node, "%s", item->iso_code);
600 if(i > 1)
601 {
602 g_string_append(node, ",");
603 }
604 }
605 i--;
606 list = g_list_next(list);
607 }
608 g_list_free(list);
609
610 return g_string_free(node, FALSE);
611 }
612
613
614 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
615
616
617 gboolean currency_online_sync(GError **error)
618 {
619 SoupSession *session;
620 SoupMessage *msg;
621 gchar *query;
622 gboolean retval = TRUE;
623
624 DB( g_printf("\n[currency] sync online\n") );
625
626 query = api_fixerio_query_build();
627 DB( g_printf("query: '%s'\n", query) );
628
629 /*
630 //test API
631 retval = api_fixerio_parse(fixeriojson, error);
632 */
633
634 session = soup_session_new ();
635 msg = soup_message_new ("GET", query);
636 if(msg != NULL)
637 {
638 soup_session_send_message (session, msg);
639 DB( g_print("status_code: %d %d\n", msg->status_code, SOUP_STATUS_IS_SUCCESSFUL(msg->status_code) ) );
640 DB( g_print("reason: %s\n", msg->reason_phrase) );
641 DB( g_print("datas: %s\n", msg->response_body->data) );
642
643 if( SOUP_STATUS_IS_SUCCESSFUL(msg->status_code) == TRUE )
644 {
645 retval = api_fixerio_parse(msg->response_body->data, error);
646 //retval = api_yahoo_parse(msg->response_body->data, error);
647 }
648 else
649 {
650 *error = g_error_new_literal(1, msg->status_code, msg->reason_phrase);
651 retval = FALSE;
652 }
653 }
654 else
655 {
656 *error = g_error_new_literal(1, 0, "cannot parse URI");
657 retval = FALSE;
658 }
659
660 g_free(query);
661
662 return retval;
663 }
664
665
666 /* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
667
668
669 //struct iso_4217_currency iso_4217_currencies[];
670
671 /*debug testing
672 static void fill_currency(void)
673 {
674 gint i;
675 struct iso_4217_currency cur;
676 Currency *item;
677
678 for (i = 0; i< 500; i++)
679 {
680 cur = iso_4217_currencies[i];
681
682 if(cur.iso_code == NULL)
683 break;
684
685 item = da_cur_malloc();
686 //no mem alloc here
687 item->key = i;
688 item->name = cur.currency;
689 item->country = cur.country;
690 item->iso_code = cur.iso_code;
691
692 da_cur_insert(item);
693
694 }
695
696
697
698 }*/
699
700 Currency4217 iso4217cur[] =
701 {
702 { "AED", 2, ".", ",", TRUE, "د.إ.‏", "UAE Dirham" },
703 { "AFN", 0, ",", ",", TRUE, "؋", "Afghani" },
704 { "ALL", 0, ",", " ", FALSE, "Lekë", "Lek" },
705 { "AMD", 2, ".", ",", FALSE, "֏", "Armenian Dram" },
706 { "ANG", 2, ",", ",", TRUE, "NAf.", "Netherlands Antillian Guilder" },
707 { "AOA", 2, ",", " ", FALSE, "Kz", "Kwanza" },
708 { "ARS", 2, ",", ".", TRUE, "$", "Argentine Peso" },
709 { "AUD", 2, ".", ",", TRUE, "$", "Australian Dollar" },
710 { "AWG", 2, ",", ".", TRUE, "Afl.", "Aruban Guilder" },
711 { "AZN", 2, ",", " ", TRUE, "₼", "Azerbaijanian Manat" },
712 { "BAM", 2, ",", ".", FALSE, "KM", "Convertible Marks" },
713 { "BBD", 2, ".", ",", TRUE, "$", "Barbados Dollar" },
714 { "BDT", 2, ".", ",", TRUE, "৳", "Taka" },
715 { "BGN", 2, ",", " ", FALSE, "лв.", "Bulgarian Lev" },
716 { "BHD", 3, ".", ",", TRUE, "د.ب.‏", "Bahraini Dinar" },
717 { "BIF", 0, ",", " ", FALSE, "FBu", "Burundi Franc" },
718 { "BMD", 2, ".", ",", TRUE, "$", "Bermudian Dollar" },
719 { "BND", 2, ",", ".", TRUE, "$", "Brunei Dollar" },
720 { "BOB", 2, ",", ".", TRUE, "Bs", "Boliviano" },
721 { "BOV", 2, ".", "", FALSE, "BOV", "Mvdol" },
722 { "BRL", 2, ",", ".", TRUE, "R$", "Brazilian Real" },
723 { "BSD", 2, ".", ",", TRUE, "$", "Bahamian Dollar" },
724 { "BTN", 2, ".", ",", TRUE, "Nu.", "Ngultrum" },
725 { "BWP", 2, ".", " ", TRUE, "P", "Pula" },
726 { "BYN", 0, ",", " ", FALSE, "Br", "Belarussian Ruble" },
727 { "BYR", 0, ",", " ", FALSE, "Br", "Old Belarussian Ruble" },
728 { "BZD", 2, ".", ",", TRUE, "$", "Belize Dollar" },
729 { "CAD", 2, ",", " ", TRUE, "$", "Canadian Dollar" },
730 { "CDF", 2, ",", " ", TRUE, "FC", "Congolese Franc" },
731 { "CHE", 2, ".", "", FALSE, "CHE", "WIR Euro" },
732 { "CHF", 2, ",", "'", TRUE, "CHF", "Swiss Franc" },
733 { "CHW", 2, ".", "", FALSE, "CHW", "WIR Franc" },
734 { "CLF", 2, ".", "", FALSE, "CLF", "Unidades de fomento" },
735 { "CLP", 0, ",", ".", TRUE, "$", "Chilean Peso" },
736 { "CNY", 2, ".", ",", TRUE, "¥", "Yuan Renminbi" },
737 { "COP", 0, ",", ".", TRUE, "$", "Colombian Peso" },
738 { "COU", 2, ".", "", FALSE, "COU", "Unidad de Valor Real" },
739 { "CRC", 0, ",", ".", TRUE, "₡", "Costa Rican Colon" },
740 { "CUP", 2, ".", ",", TRUE, "$", "Cuban Peso" },
741 { "CVE", 2, "$", " ", FALSE, "​", "Cape Verde Escudo" },
742 { "CYP", 2, ".", "", FALSE, "CYP", "Cyprus Pound" },
743 { "CZK", 2, ",", " ", FALSE, "Kč", "Czech Koruna" },
744 { "DJF", 0, ",", " ", TRUE, "Fdj", "Djibouti Franc" },
745 { "DKK", 2, ",", ".", TRUE, "kr", "Danish Krone" },
746 { "DOP", 2, ".", ",", TRUE, "$", "Dominican Peso" },
747 { "DZD", 2, ",", " ", FALSE, "DA", "Algerian Dinar" },
748 { "EEK", 2, ".", "", FALSE, "EEK", "Kroon" },
749 { "EGP", 2, ".", ",", TRUE, "ج.م.‏", "Egyptian Pound" },
750 { "ERN", 2, ".", ",", TRUE, "Nfk", "Nakfa" },
751 { "ETB", 2, ".", ",", TRUE, "Br", "Ethiopian Birr" },
752 { "EUR", 2, ",", " ", TRUE, "€", "Euro" },
753 { "FJD", 2, ".", ",", TRUE, "$", "Fiji Dollar" },
754 { "FKP", 2, ".", ",", TRUE, "£", "Falkland Islands Pound" },
755 { "GBP", 2, ".", ",", TRUE, "£", "Pound Sterling" },
756 { "GEL", 2, ",", " ", TRUE, "₾", "Lari" },
757 { "GHS", 2, ".", ",", TRUE, "GH₵", "Ghana Cedi" },
758 { "GIP", 2, ".", ",", TRUE, "£", "Gibraltar Pound" },
759 { "GMD", 2, ".", ",", TRUE, "D", "Dalasi" },
760 { "GNF", 0, ",", " ", TRUE, "FG", "Guinea Franc" },
761 { "GTQ", 2, ".", ",", TRUE, "Q", "Quetzal" },
762 { "GYD", 0, ".", ",", TRUE, "$", "Guyana Dollar" },
763 { "HKD", 2, ".", ",", TRUE, "$", "Hong Kong Dollar" },
764 { "HNL", 2, ".", ",", TRUE, "L", "Lempira" },
765 { "HRK", 2, ",", ".", FALSE, "kn", "Croatian Kuna" },
766 { "HTG", 2, ",", " ", FALSE, "G", "Gourde" },
767 { "HUF", 2, ",", " ", FALSE, "HUF", "Forint" },
768 { "IDR", 0, ",", ".", TRUE, "Rp", "Rupiah" },
769 { "ILS", 2, ".", ",", TRUE, "₪", "New Israeli Sheqel" },
770 { "INR", 2, ".", ",", TRUE, "₹", "Indian Rupee" },
771 { "IQD", 2, ".", ",", TRUE, "د.ع.‏", "Iraqi Dinar" },
772 { "IRR", 2, "/", ",", TRUE, "ريال", "Iranian Rial" },
773 { "ISK", 0, ",", ".", FALSE, "ISK", "Iceland Krona" },
774 { "JMD", 2, ".", ",", TRUE, "$", "Jamaican Dollar" },
775 { "JOD", 3, ".", ",", TRUE, "د.ا.‏", "Jordanian Dinar" },
776 { "JPY", 0, ".", ",", TRUE, "¥", "Yen" },
777 { "KES", 2, ".", ",", TRUE, "Ksh", "Kenyan Shilling" },
778 { "KGS", 2, ",", " ", FALSE, "сом", "Som" },
779 { "KHR", 2, ".", ",", FALSE, "៛", "Riel" },
780 { "KMF", 0, ",", " ", TRUE, "CF", "Comoro Franc" },
781 { "KPW", 2, ".", "", FALSE, "KPW", "North Korean Won" },
782 { "KRW", 0, ".", ",", TRUE, "₩", "Won" },
783 { "KWD", 3, ".", ",", TRUE, "د.ك.‏", "Kuwaiti Dinar" },
784 { "KYD", 2, ".", ",", TRUE, "$", "Cayman Islands Dollar" },
785 { "KZT", 2, ",", " ", FALSE, "₸", "Tenge" },
786 { "LAK", 0, ",", ".", TRUE, "₭", "Kip" },
787 { "LBP", 2, ".", ",", TRUE, "ل.ل.‏", "Lebanese Pound" },
788 { "LKR", 2, ".", ",", TRUE, "Rs.", "Sri Lanka Rupee" },
789 { "LRD", 2, ".", ",", TRUE, "$", "Liberian Dollar" },
790 { "LSL", 2, ".", "", FALSE, "LSL", "Loti" },
791 { "LTL", 2, ".", "", FALSE, "LTL", "Lithuanian Litas" },
792 { "LVL", 2, ".", "", FALSE, "LVL", "Latvian Lats" },
793 { "LYD", 3, ".", ",", TRUE, "د.ل.‏", "Libyan Dinar" },
794 { "MAD", 2, ",", " ", FALSE, "DH", "Moroccan Dirham" },
795 { "MDL", 2, ",", " ", FALSE, "L", "Moldovan Leu" },
796 { "MGA", 0, ",", " ", TRUE, "Ar", "Malagasy Ariary" },
797 { "MKD", 2, ",", " ", TRUE, "den", "Denar" },
798 { "MMK", 0, ".", ",", TRUE, "K", "Kyat" },
799 { "MNT", 0, ".", ",", TRUE, "₮", "Tugrik" },
800 { "MOP", 2, ",", " ", TRUE, "MOP", "Pataca" },
801 { "MRO", 0, ",", " ", TRUE, "UM", "Ouguiya" },
802 { "MTL", 2, ".", "", FALSE, "MTL", "Maltese Lira" },
803 { "MUR", 0, ",", " ", TRUE, "Rs", "Mauritius Rupee" },
804 { "MVR", 2, ".", ",", FALSE, "ރ.", "Rufiyaa" },
805 { "MWK", 2, ".", ",", TRUE, "MK", "Kwacha" },
806 { "MXN", 2, ".", ",", TRUE, "$", "Mexican Peso" },
807 { "MXV", 2, ".", "", FALSE, "MXV", "Mexican Unidad de Inversion (UDI)" },
808 { "MYR", 2, ".", ",", TRUE, "RM", "Malaysian Ringgit" },
809 { "MZN", 2, ",", " ", FALSE, "MTn", "Metical" },
810 { "NAD", 2, ",", " ", TRUE, "$", "Namibia Dollar" },
811 { "NGN", 2, ".", ",", TRUE, "₦", "Naira" },
812 { "NIO", 2, ".", ",", TRUE, "C$", "Cordoba Oro" },
813 { "NOK", 2, ",", " ", TRUE, "kr", "Norwegian Krone" },
814 { "NPR", 2, ".", ",", TRUE, "रु", "Nepalese Rupee" },
815 { "NZD", 2, ".", ",", TRUE, "$", "New Zealand Dollar" },
816 { "OMR", 3, ".", ",", TRUE, "ر.ع.‏", "Rial Omani" },
817 { "PAB", 2, ".", ",", TRUE, "B/.", "Balboa" },
818 { "PEN", 2, ".", ",", TRUE, "S/.", "Nuevo Sol" },
819 { "PGK", 2, ".", ",", TRUE, "K", "Kina" },
820 { "PHP", 2, ",", ",", TRUE, "₱", "Philippine Peso" },
821 { "PKR", 0, ".", ",", TRUE, "Rs", "Pakistan Rupee" },
822 { "PLN", 2, ",", " ", FALSE, "zł", "Zloty" },
823 { "PYG", 0, ",", ".", TRUE, "₲", "Guarani" },
824 { "QAR", 2, ".", ",", TRUE, "ر.ق.‏", "Qatari Rial" },
825 { "RON", 2, ",", ".", FALSE, "RON", "New Leu" },
826 { "RSD", 0, ",", ".", FALSE, "RSD", "Serbian Dinar" },
827 { "RUB", 2, ",", " ", TRUE, "₽", "Russian Ruble" },
828 { "RWF", 0, ",", " ", TRUE, "RF", "Rwanda Franc" },
829 { "SAR", 2, ".", ",", TRUE, "ر.س.‏", "Saudi Riyal" },
830 { "SBD", 2, ".", ",", TRUE, "$", "Solomon Islands Dollar" },
831 { "SCR", 2, ",", " ", TRUE, "SR", "Seychelles Rupee" },
832 { "SDG", 2, ".", ",", TRUE, "SDG", "Sudanese Pound" },
833 { "SEK", 2, ",", ".", FALSE, "kr", "Swedish Krona" },
834 { "SGD", 2, ".", ",", TRUE, "$", "Singapore Dollar" },
835 { "SHP", 2, ".", ",", TRUE, "£", "Saint Helena Pound" },
836 { "SLL", 0, ".", ",", TRUE, "Le", "Leone" },
837 { "SOS", 0, ".", ",", TRUE, "S", "Somali Shilling" },
838 { "SRD", 2, ",", ".", TRUE, "$", "Surinam Dollar" },
839 { "STD", 0, ",", " ", FALSE, "Db", "Dobra" },
840 { "SVC", 2, ".", "", FALSE, "SVC", "El Salvador Colon" },
841 { "SYP", 0, ",", " ", TRUE, "LS", "Syrian Pound" },
842 { "SZL", 2, ",", " ", TRUE, "E", "Lilangeni" },
843 { "THB", 2, ".", ",", TRUE, "฿", "Baht" },
844 { "TJS", 2, ",", " ", FALSE, "смн", "Somoni" },
845 { "TMM", 2, ".", "", FALSE, "TMM", "Manat" },
846 { "TND", 3, ",", " ", TRUE, "DT", "Tunisian Dinar" },
847 { "TOP", 2, ".", ",", TRUE, "T$", "Pa'anga" },
848 { "TRY", 2, ",", ".", FALSE, "₺", "New Turkish Lira" },
849 { "TTD", 2, ".", ",", TRUE, "$", "Trinidad and Tobago Dollar" },
850 { "TWD", 2, ".", ",", TRUE, "NT$", "New Taiwan Dollar" },
851 { "TZS", 0, ".", ",", TRUE, "TSh", "Tanzanian Shilling" },
852 { "UAH", 2, ",", " ", FALSE, "₴", "Hryvnia" },
853 { "UGX", 0, ".", ",", TRUE, "USh", "Uganda Shilling" },
854 { "USD", 2, ",", " ", TRUE, "$", "US Dollar" },
855 { "USN", 2, ".", "", FALSE, "USN", "US Dollar (Next day)" },
856 { "USS", 2, ".", "", FALSE, "USS", "US Dollar (Same day)" },
857 { "UYI", 2, ".", "", FALSE, "UYI", "Uruguay Peso en Unidades Indexadas" },
858 { "UYU", 2, ",", ".", TRUE, "$", "Peso Uruguayo" },
859 { "UZS", 0, ",", " ", TRUE, "soʻm", "Uzbekistan Sum" },
860 { "VEF", 2, ",", ".", TRUE, "Bs.", "Bolivar Fuerte" },
861 { "VND", 2, ",", ".", FALSE, "₫", "Dong" },
862 { "VUV", 0, ",", " ", TRUE, "VT", "Vatu" },
863 { "WST", 2, ".", ",", TRUE, "WS$", "Tala" },
864 { "XAF", 0, ",", " ", TRUE, "FCFA", "CFA Franc BEAC" },
865 { "XAG", 2, ".", "", FALSE, "XAG", "Silver" },
866 { "XAU", 2, ".", "", FALSE, "XAU", "Gold" },
867 { "XBA", 2, ".", "", FALSE, "XBA", "European Composite Unit (EURCO)" },
868 { "XBB", 2, ".", "", FALSE, "XBB", "European Monetary Unit (E.M.U.-6)" },
869 { "XBC", 2, ".", "", FALSE, "XBC", "European Unit of Account 9 (E.U.A.-9)" },
870 { "XBD", 2, ".", "", FALSE, "XBD", "European Unit of Account 17 (E.U.A.-17)" },
871 { "XCD", 2, ",", " ", TRUE, "$", "East Caribbean Dollar" },
872 { "XDR", 2, ",", " ", TRUE, "XDR", "Special Drawing Rights" },
873 { "XFO", 2, ".", "", FALSE, "XFO", "Gold-Franc" },
874 { "XFU", 2, ".", "", FALSE, "XFU", "UIC-Franc" },
875 { "XOF", 0, ",", " ", TRUE, "CFA", "CFA Franc BCEAO" },
876 { "XPD", 2, ".", "", FALSE, "XPD", "Palladium" },
877 { "XPF", 0, ",", " ", FALSE, "FCFP", "CFP Franc" },
878 { "XPT", 2, ".", "", FALSE, "XPT", "Platinum" },
879 { "XTS", 2, ".", "", FALSE, "XTS", "Code for testing purposes" },
880 { "XXX", 2, ".", "", FALSE, "XXX", "No currency" },
881 { "YER", 2, ".", ",", TRUE, "ر.ي.‏", "Yemeni Rial" },
882 { "ZAR", 2, ",", " ", TRUE, "R", "Rand" },
883 { "ZMK", 2, ".", "", FALSE, "ZMK", "Zambian Kwacha" },
884 { "ZWD", 2, ".", "", FALSE, "ZWD", "Zimbabwe Dollar" }
885 };
886 guint n_iso4217cur = G_N_ELEMENTS (iso4217cur);
887
This page took 0.079922 seconds and 4 git commands to generate.