我正在尝试使用boost :: locale :: to_upper来根据boost-locale页面http://www.boost.org/doc/libs/1_50_0/libs/locale/doc/html/conversions.html
执行特定于语言环境的上层框架该文本表明我应该能够在'grüßEN'上使用boost :: locale :: to_upper并获得结果'GRÜSSEN' - 这是正确的特定于语言环境的大写版本(我相信)。
在我的测试版中,我得到'GRÜßEN'而不是'GRÜSSEN'。
我的测试代码看起来像这样(我使用utf8cpp检查我的字符串实际上是utf8):
boost::locale::generator gen;
std::locale loc= gen("de_DE.UTF-8");
std::locale::global(loc);
cout.imbue(loc);
string s = "grüßEN";
if (utf8::is_valid(s.begin(), s.end())){
std::cout << s << " U= "<< boost::locale::to_upper(s) << std::endl;
}
这是在OSX(10.7.4)上使用Xcode(4.1)。我已经安装了ICU(49_1_2),其建议选项为-DU_USING_ICU_NAMESPACE = 0 -DU_CHARSET_IS_UTF8 = 1。 ICU位于/ usr / local / include / unicode和/ usr / local / lib / libicu *中的库。*
我从1_48套件中构建了boost :: locale,如下所示:
./bjam boost.locale.iconv=off -sICU_PATH=/usr/local --with-locale stage
并在构建报告时:
Performing configuration checks
- icu : yes
Component configuration:
- chrono : not building
- date_time : not building
- exception : not building
- filesystem : not building
- graph : not building
- graph_parallel : not building
- iostreams : not building
- locale : building
- math : not building
- mpi : not building
- program_options : not building
- python : not building
- random : not building
- regex : not building
- serialization : not building
- signals : not building
- system : not building
- test : not building
- thread : not building
- timer : not building
- wave : not building
...patience...
...patience...
...found 1850 targets...
...updating 25 targets...
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv- off/threading-multi/encoding/codepage.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/boundary.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/codecvt.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/collator.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/conversion.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/date_time.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/formatter.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/icu_backend.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/numeric.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/icu/time_zone.o
darwin.link.dll bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/threading-multi/libboost_locale.dylib
common.copy stage/lib/libboost_locale.dylib
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv- off/link-static/threading-multi/encoding/codepage.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/boundary.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/codecvt.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/collator.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/conversion.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/date_time.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/formatter.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/icu_backend.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/numeric.o
darwin.compile.c++ bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/time_zone.o
darwin.archive bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/libboost_locale.a
/usr/bin/libtool: warning same member name (codecvt.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link- static/threading-multi/std/codecvt.o and: bin.v2/libs/locale/build/darwin- 4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/codecvt.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (codecvt.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/codecvt.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/codecvt.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (collate.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/std/collate.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/collate.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (converter.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/std/converter.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/converter.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (date_time.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/date_time.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/shared/date_time.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (numeric.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/icu/numeric.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/numeric.o (due to use of basename, truncation, blank padding or duplicate input files)
/usr/bin/libtool: warning same member name (numeric.o) in output file used for input files: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/posix/numeric.o and: bin.v2/libs/locale/build/darwin-4.2.1/release/boost.locale.iconv-off/link-static/threading-multi/std/numeric.o (due to use of basename, truncation, blank padding or duplicate input files)
common.copy stage/lib/libboost_locale.a
...updated 25 targets...
根据https://svn.boost.org/trac/boost/ticket/6424,警告可以被忽略(或者有人知道更好吗?) 我将构建的libs从stage / libs复制到/ usr / local / libs。
据我所知,它是针对ICU正确构建的。我的测试代码确实要求我链接到libiconv - 我会认为没有必要,因为我关闭了构建中的图标?
任何人都可以向我提供一些有关正在发生的事情/我做错了什么以及为什么我没有按照文档记录的预期行为 - 或者至少有一些事情需要尝试?
欢呼声
克里斯
答案 0 :(得分:0)
所以XCODE在我身上崩溃了(因为它似乎经常这样做),一旦我重新启动它并重新构建项目,它就会要求ICU库并且不再需要iconv库 - 即按预期的那样。 我想要将那一个粉笔给XCODE伏都教。我将留下这个问题,因为它至少涵盖了如何在OSX上使用ICU构建boost语言环境。