scoder · GitHub

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.

Read the original on github.com ↗