Valid Locale Names

前端 未结 1 634
花落未央
花落未央 2020-12-29 05:10

How do you find valid locale names?

I am currently using MAC OS X.
But information about other platforms would also be useful.

#include 

        
相关标签:
1条回答
  • 2020-12-29 05:27

    This page says:

    The constructor call std::locale("") creates a locale object that represents the user's preferences. The standard doesn't say what this means, but on many systems the library substitutes whatever is found in an environment variable (often LANG or LC_ALL) in place of the empty string. A common name for the American locale, for example, is "en_US". (On POSIX systems you can type locale -a to list the names of supported locales.)

    locale -a should work for you.

    If you mean programatically from the C++ std libary I'm not sure.

    This stack overflow question is probably also relevant, but he doesn't seem to have had much response.

    Edit

    To use UTF-16 you probably will need to use libiconv as mentioned in this question.

    0 讨论(0)
提交回复
热议问题