9

我在几个地方读到 boost::algorithm::to_upper/to_lower 不适用于 utf8:

但是在我的系统上,ubuntu 12.4.1 32 bits with boost 1.46, and locale en_GB.UTF-8,一切看起来都很好,只要我通过了语言环境例如:

std::locale englishUTF8locale("en_GB.UTF-8")
boost::algorithm::to_upper_copy(L"ü", englishUTF8locale) -> L"Ü"
boost::algorithm::to_lower_copy(L"и", englishUTF8locale) ->L"И"

值得注意的是它在使用 std::wstring 时有效,但在使用 std::string 时无效

那么, boost::locale 真的没有必要吗?我的问题是我只能使用 boost 1.46,并且语言环境是为 1.48 创建的

4

0 回答 0