mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
strfmon: Trim the SPACE from international currency symbol
The international currency symbol (int_curr_symbol) has a mandatory
SPACE character as the last character.
Trim this space after reading it, otherwise this extra space will always
be printed when displaying the int_curr_symbol.
Fixes the output when the international currency format is selected
(%i).
Locale Format Before After
en_US.UTF-8 [%i] [USD 123.45] [USD123.45]
fr_FR.UTF-8 [%i] [123,45 EUR ] [123,45 EUR]
Note that the en_US.UTF-8 locale states that no space should be printed
between the currency symbol and the value (sep_by_space = 0).
Reviewed by: kib
PR: 267282
Github PR: #619
MFC after: 1 week
This commit is contained in:
parent
9e03b903e3
commit
6da51e19e3
2 changed files with 5 additions and 3 deletions
|
|
@ -240,8 +240,10 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
|
|||
if (flags & USE_INTL_CURRENCY) {
|
||||
currency_symbol = strdup(lc->int_curr_symbol);
|
||||
if (currency_symbol != NULL &&
|
||||
strlen(currency_symbol) > 3)
|
||||
strlen(currency_symbol) > 3) {
|
||||
space_char = currency_symbol[3];
|
||||
currency_symbol[3] = '\0';
|
||||
}
|
||||
} else
|
||||
currency_symbol = strdup(lc->currency_symbol);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,8 +195,8 @@ ATF_TC_BODY(strfmon_international_currency_code, tc)
|
|||
const char *locale;
|
||||
const char *expected;
|
||||
} tests[] = {
|
||||
{ "en_US.UTF-8", "[USD 123.45]" }, /* XXX */
|
||||
{ "de_DE.UTF-8", "[123,45 EUR ]" }, /* XXX */
|
||||
{ "en_US.UTF-8", "[USD123.45]" },
|
||||
{ "de_DE.UTF-8", "[123,45 EUR]" },
|
||||
{ "C", "[123.45]" },
|
||||
};
|
||||
size_t i;
|
||||
|
|
|
|||
Loading…
Reference in a new issue