google / google/googletest

Invalid characters printed to XML-Output

Open
#2,953 2 comments 0 reactions 1 assignee Claimed by @derekmauro View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

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](https://github.com/google/googletest/files/4965030/patch_file.txt)

Kind regards,
René Oschmann (SAP SE)

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.