How can I compile boost :: spirit for an unsigned char type?

boost :: spirit claims boost :: spirit :: char_class :: isalnum ASCII ()

when passing ascci characters> 127.

I changed all my personal variables from std :: string to

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

      

but still forces the use of std: .string internally. What should I do?

+2


source to share


2 answers


The solution is pretty simple:

instead

using namespace boost::spirit::ascii;

      



Now I am using

using namespace boost::spirit::iso8859_1;

      

This will recognize all characters in the iso8859 character set.

+3


source


The problem, of course, is that the ASCII characters are above 127. No. Shorter byte interpretation = 8 bits.



If you are using ISO8859-1 or UTF-8 as your character encoding, you must set up your compiler correctly. This micht option is called "default char unsigned" or something like that to reflect the fact that ISO-8859 does indeed use character values ​​above 127.

+1


source







All Articles