#2953·googletest

Invalid characters printed to XML-Output

Author: ReneOschmannCreated Jul 23, 2020Updated Sep 7, 2026

Hi gtest-team,

In our project we found some problem with the XML-output since we use compiler option -funsigned-char.

The characters U+FFFE and U+FFFF and surrogates are not allowed in XML[1], but legal in UTF-8/-16. Parameterized tests e.g. for parsers might print such characters in case the compiler flag is set. The reason is that IsValidUTF8 implicitly relies on signed char behaviour.

I am aware that there are #1931, #1957 and #2932 which go into the direction of having full UTF-8 support in XML output. However, for now I would just fix IsValidUTF8 to behave similarly when using unsigned chars as default.

I can make a pull request if you think this is a valid proposal. Proposed change: patch_file.txt

Kind regards, René Oschmann (SAP SE)

[1] https://www.w3.org/TR/REC-xml/#charsets