开发者

How can i compile boost::spirit for unsigned char type?

boost::spirit asserts at boost::spirit::char_class::ascii::isalnum()

when passing ascci characters > 127.

I changed all my private variables from std::string to a

typedef std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> >
 u_string;

but still boo开发者_JAVA百科st uses std:.string internally. What do i have to do ?


The solution is quite simple:

instead of

using namespace boost::spirit::ascii;

i now use

using namespace boost::spirit::iso8859_1;

This recognizes all charcters in the iso8859 character set.


The problem is of course that there are no ASCII characters above 127. The interpretation of byte=8 bit is more recent than that.

If you're using ISO8859-1 or UTF-8 as a character encoding, you should configure your compiler correctly. This option micht be called " default char unsigned" or something like that, to reflect the fact that ISO-8859 does use character values above 127.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜