
Hey! I have some small questions about Boost.Locale. 1. Is it safe to assume that Boost.Locale API methods (like gettext) return UTF-8 strings, or are they locale dependent? 2. I use a custom domain, but when calling gettext("...") I still get lovely English text. However, calling gettext("...", std::locale()) fixes that. Is there some way to set the default domain/locale for gettext so I can simply write gettext("...")? 3. What's the deal with the whole locale/$LANG/LC_MESSAGES/$domain.mo folder structure? I know it has Unix heritage, but why is it explicity forced? It seems like a complex structure compared to locale/$LANG-$domain.mo.

From: Jookia <166291@gmail.com> < Hey! I have some small questions about Boost.Locale.
1. Is it safe to assume that Boost.Locale API methods (like gettext) return UTF-8 strings, or are they locale dependent?
No encoding is locale dependent however UTF-8 is OS default on all modern systems. You can check it using boost::locale::info facet.
2. I use a custom domain, but when calling gettext("...") I still get lovely English text. However, calling gettext("...", std::locale()) fixes that. Is there some way to set the default domain/locale for gettext so I can simply write gettext("...")?
Use std::locale::global(locale_you_need_to_install)
3. What's the deal with the whole locale/$LANG/LC_MESSAGES/$domain.mo folder structure? I know it has Unix heritage, but why is it explicity forced? It seems like a complex structure compared to locale/$LANG-$domain.mo.
This is standard gettext directory structure. It is used by windows gettext users as well Using LC_MESSAGES would allow to extend the catalogs with some more data. Artyom

On Mon, Nov 07, 2011 at 02:35:09AM -0800, Artyom Beilis wrote:
From: Jookia <166291@gmail.com> < Hey! I have some small questions about Boost.Locale.
1. Is it safe to assume that Boost.Locale API methods (like gettext) return UTF-8 strings, or are they locale dependent?
No encoding is locale dependent however UTF-8 is OS default on all modern systems.
Artyom: Please confirm whether you consider Windows a "modern system" here, or if this is more of your subtle crusade against one of the major platforms. -- Lars Viklund | zao@acc.umu.se

--- On Mon, 11/7/11, Lars Viklund
From: Lars Viklund
Subject: Re: [Boost-users] [locale] Quick questions To: boost-users@lists.boost.org Date: Monday, November 7, 2011, 8:07 PM On Mon, Nov 07, 2011 at 02:35:09AM -0800, Artyom Beilis wrote: From: Jookia <166291@gmail.com> < Hey! I have some small questions about Boost.Locale.
1. Is it safe to assume that Boost.Locale API methods (like gettext) return UTF-8 strings, or are they locale dependent?
No encoding is locale dependent however UTF-8 is OS default on all modern systems.
Artyom: Please confirm whether you consider Windows a "modern system" here,
Actually under Windows it is explicitly UTF-8 by default: http://beta.boost.org/doc/libs/1_48_0_beta1/libs/locale/doc/html/default_enc... Also it can be overridden by enviroment variable like LANG even on Windows (however it is not in use by default on this OS) On other systems (POSIX systems) like Linux, FreeBSD, Solaris, Darwin it may not be UTF-8 as well. However the default encoding on recent versions of these operating systems is UTF-8 and non-Unicode encodings are quite deprecated. So if the question whether it is likely to be UTF-8 then yes, if it may be not-UTF-8 then yes as well.
or if this is more of your subtle crusade against one of the major platforms.
No it is not crusade against Windows. And Windows is modern (even thou crappy) operating system. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/
participants (3)
-
Artyom Beilis
-
Jookia
-
Lars Viklund