// code
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#define SIZE 32
const char name[][SIZE] = {"en_US.utf8", "zh_CN.utf8", "zh_HK.utf8", "zh_TW.big5", "fr_BE.iso88591"};
int main(void)
{
int count = sizeof(name) / SIZE;
for (int i = 0; i < count; i++)
{
setlocale(LC_ALL, name[i]);
const struct lconv *p = localeconv();
printf("locale:[%s], currency symbol: [%s]\n", name[i], p->currency_symbol);
printf("locale:[%s], international currency symbol: [%s]\n", name[i], p->int_curr_symbol); // why a tail space
}
return 0;
}
// output
locale:[en_US.utf8], currency symbol: [$]
locale:[en_US.utf8], international currency symbol: [USD ]
locale:[zh_CN.utf8], currency symbol: [?]
locale:[zh_CN.utf8], international currency symbol: [CNY ]
locale:[zh_HK.utf8], currency symbol: [HK$]
locale:[zh_HK.utf8], international currency symbol: [HKD ]
locale:[zh_TW.big5], currency symbol: [NT$]
locale:[zh_TW.big5], international currency symbol: [TWD ]
locale:[fr_BE.iso88591], currency symbol: [EUR]
locale:[fr_BE.iso88591], international currency symbol: [EUR ]
为什么每个“国际货币符号”都以空格字符结尾?我对结果很困惑,谁能给我一些帮助?