mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-17 02:25:38 +02:00
Do not violate UTF-8 in XML output
According to UTF-8 encoding rules, there are no valid one byte long codepoints which start with a bigh bit set (i.e. 0x80 or higher value). Hence such XML output needs to be escaped, same as a control character.
This commit is contained in:
@@ -38,4 +38,8 @@ TEST_CASE( "XmlEncode" ) {
|
||||
SECTION( "string with control char (x7F)" ) {
|
||||
REQUIRE( encode( "[\x7F]" ) == "[\\x7F]" );
|
||||
}
|
||||
}
|
||||
SECTION( "string with high bit set (x80 and xFF)" ) {
|
||||
REQUIRE( encode( "[\x80]" ) == "[\\x80]" );
|
||||
REQUIRE( encode( "[\xFF]" ) == "[\\xFF]" );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user