[INTERPRETER]

* BUG: Fix thousand separator for locales like norwegian that return an 
  UTF-8 non-breaking space. Replace it by a normal space.


git-svn-id: svn://localhost/gambas/trunk@7318 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2015-09-16 22:51:31 +00:00
parent 8665f8766d
commit 2395af1a33

View file

@ -356,6 +356,17 @@ static void free_local_info(void)
CLEAR(&LOCAL_local);
}
static char fix_separator(const char *str)
{
if (!*str || !str[1])
return str[0];
if ((uchar)str[0] == 0xC2 && (uchar)str[1] == 0xA0 && str[2] == 0)
return ' ';
return '?';
}
static void fill_local_info(void)
{
struct lconv *info;
@ -399,7 +410,7 @@ static void fill_local_info(void)
//fprintf(stderr, "'%s' '%s'\n", nl_langinfo(THOUSANDS_SEP), nl_langinfo(MON_THOUSANDS_SEP));
LOCAL_local.decimal_point = *(info->decimal_point);
LOCAL_local.thousand_sep = *(info->thousands_sep);
LOCAL_local.thousand_sep = fix_separator(info->thousands_sep);
if (LOCAL_local.thousand_sep == 0)
LOCAL_local.thousand_sep = ' ';
LOCAL_local.group_size = *(info->grouping);
@ -537,10 +548,7 @@ static void fill_local_info(void)
lang = LOCAL_get_lang();
if (strcmp(lang, "fr") == 0 || strncmp(lang, "fr_", 3) == 0)
{
LOCAL_local.date_sep = '/';
//LOCAL_local.thousand_sep = '~';
}
stradd_sep(LOCAL_local.general_date, LOCAL_local.long_time, " ");
am_pm = nl_langinfo(AM_STR);
@ -555,7 +563,7 @@ static void fill_local_info(void)
// Currency format
LOCAL_local.currency_thousand_sep = *(info->mon_thousands_sep);
LOCAL_local.currency_thousand_sep = fix_separator(info->mon_thousands_sep);
if (LOCAL_local.currency_thousand_sep == 0)
LOCAL_local.currency_thousand_sep = ' ';
LOCAL_local.currency_group_size = *(info->mon_grouping);