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

properly enable in-code hex entity encoder #238

merged 1 commit into from Apr 13, 2017


Copy link

@matejcik matejcik commented Apr 11, 2017

Function _write_attr_string improperly handles the fact that signedness of char is implementation- and platform-defined. Furthermore, in x86-land, the default is signed char, so cur[0] >= 0x80 is always false and the whole branch is dead code.

That means that function xmlSerializeHexCharRef never actually executed and the encoding was happening magically inside libxml. (This is evidenced by the fact that xmlSerializeHexCharRef generates hex-based entities, but test_attribute_quoting_unicode was checking for decimal-based encoding. With that said, I'm very curious if commit 7eef158 ever actually did anything?)

This PR forces using unsigned chars where appropriate, fixes incorrect xmlOutputBufferWrite call, and updates the testcase to test for hex-based encoding.

Copy link

@scoder scoder commented Apr 13, 2017


@scoder scoder merged commit 8e02eb0 into lxml:master Apr 13, 2017
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
2 participants