boost::asio 不是完全兼容 UNICODE 吗?
我正在编写一个 C++ 应用程序,它使用 boost::asio 进行一些 http 操作。我选择了 boost::asio ,假设它完全兼容 unicode。但是,我无法在 UNICODE 中进行编译,因为 asio 的某些部分被硬编码为 char。
例证:
#ifndef TCHAR
#ifdef _UNICODE
#define TCHAR wchar_t
#else
#define TCHAR char
#endif
#endif
// The following lines only complile in MBCS and not in UNICODE.
boost::asio::basic_streambuf<std::allocator<TCHAR> > request;
std::basic_ostream<TCHAR, std::char_traits<TCHAR> > requestStream(&request);
boost::asio::read_until 函数接受 char 作为分隔符。我在这里做错了什么吗?请注意,我是 unicode 新手,以前从未需要过它。
boost::asio::basic_streambuf 派生自 std::streambuf 而不是 std::basic_streambuf,所以我怀疑 boost::asio 并不是真正符合 UNICODE 的。
I am writing a C++ application that is using boost::asio for some http operations. I chose boost::asio assuming it is fully unicode compliant. However, I am unable compile in UNICODE because some part of asio is hardcoded to char.
Case in point:
#ifndef TCHAR
#ifdef _UNICODE
#define TCHAR wchar_t
#else
#define TCHAR char
#endif
#endif
// The following lines only complile in MBCS and not in UNICODE.
boost::asio::basic_streambuf<std::allocator<TCHAR> > request;
std::basic_ostream<TCHAR, std::char_traits<TCHAR> > requestStream(&request);
The boost::asio::read_until function accepts char as a delimiter. Am I doing something wrong here? Please note I am new to unicode, never needed it before.
boost::asio::basic_streambuf derives from std::streambuf instead of std::basic_streambuf, so I suspect boost::asio is not really UNICODE compliant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确,boost::asio 不符合 UNICODE。
Correct, boost::asio is not UNICODE compliant.