Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iso8859_1::isgraph doesn't work correctly #741

Open
WitekT opened this issue Nov 15, 2022 · 0 comments
Open

iso8859_1::isgraph doesn't work correctly #741

WitekT opened this issue Nov 15, 2022 · 0 comments

Comments

@WitekT
Copy link

WitekT commented Nov 15, 2022

I parse such string: "¶" (0xb6 character) with such parser:

boost::spirit::qi::rule< std::string::const_iterator > validCharRule
	= +( boost::spirit::qi::iso8859_1::graph );

std::string test = "\xb6";
auto it = test.cbegin();
auto end = test.cend();

if ( !boost::spirit::qi::parse( it, end, validCharRule ) || it != end )
	std::cout << "error: " << std::string( it, end ) << std::endl;
else
	std::cout << "ok" << std::endl;

The problem is here, but may be also cause by cast_char from BOOST_SPIRIT_CLASSIFY:

isgraph(int ch)
        {
            return ('\x21' <= ch && ch <= '\x7e') || ('\xa1' <= ch && ch <= '\xff');
        }

ch is equal to 182 and it is compared eg. with -95 ('\xa1') -1 ('\xff').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant