Produce valid xml and preserve utf8 characters in attributes

This commit is contained in:
Ludger Sprenker
2016-02-06 14:31:24 +01:00
parent 3bd20bf2cd
commit f37c95088c
2 changed files with 91 additions and 6 deletions

View File

@@ -458,10 +458,16 @@ TEST_CASE( "XmlEncode" ) {
REQUIRE( encode( stringWithQuotes, Catch::XmlEncode::ForAttributes ) == "don't "quote" me on that" );
}
SECTION( "string with control char (1)" ) {
REQUIRE( encode( "[\x01]" ) == "[&#x1]" );
REQUIRE( encode( "[\x01]" ) == "[]" );
}
SECTION( "string with control char (x7F)" ) {
REQUIRE( encode( "[\x7F]" ) == "[&#x7F]" );
REQUIRE( encode( "[\x7F]" ) == "[]" );
}
SECTION( "string with control char that is negativ on signed char (xFF)" ) {
REQUIRE( encode( "[\xFF]" ) == "[ÿ]" );
}
SECTION( "string with utf8 multi byte char (german 'ae' umlaut)" ) {
REQUIRE( encode( "[\xC3\xA4]" ) == "[\xC3\xA4]" );
}
}