cptkidd
cptkidd

Reputation: 37

C++ locale currency displaying - slavic currencies problem

I have to display some monetical values in c++ program using locale formatting. Everything works fine for locales such as en_US or tr_TR. In pl_PL and cs_CZ however, the result goes as follows: 1�235,45 zł. I tried to identify the mysterious character using thousands_sep() method and it shows that the character code is 8239 what is absurd because it refers to the chinese charater 船. Is it how it's supposed to be or is it maybe a problem with my terminal? I'm using Manjaro Linux by the way.

Upvotes: 0

Views: 65

Answers (1)

cptkidd
cptkidd

Reputation: 37

This helped me solve my problem: How to print wstring on Linux/OS X?

As Hans Passant noted, that strange character is a narrow non-break space, which I had a problem with when I was trying to print it in the terminal. According to the answer from the link above I put std::setlocale(LC_ALL, "") at the beginning of my program and this helped - now all narrow non-break spaces, as well as other unicode characters, are printed correctly using both std::cout and std::wcout.

Upvotes: 0

Related Questions