This commit is contained in:
ninja
2025-12-15 23:22:33 +08:00
parent 019570564b
commit 8782765fbc
809 changed files with 118753 additions and 18289 deletions

View File

@@ -107,19 +107,26 @@ void _TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString
}
else if ( c < 32 )
{
// Easy pass at non-alpha/numeric/symbol
// Below 32 is symbolic.
char buf[ 32 ];
// NOTE: ASCII characters < 32 are control characters.
// only control characters 0x09, 0x0A and 0x0D are allowed in XML 1.0, others need to be stored in XML 1.1
// Since XML 1.1 is not supported properly by most applications (including web browsers), we don't want to store the "XML 1.1"-specific control characters.
// For more information, see https://en.wikipedia.org/wiki/Valid_characters_in_XML
if(c == 0x09 || c == 0x0D || c == 0x0A)
{
// Easy pass at non-alpha/numeric/symbol.
// Below 32 is symbolic.
char buf[ 32 ];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
#else
sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
#endif
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
#else
sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
#endif
//*ME: warning C4267: convert 'size_t' to 'int'
//*ME: Int-Cast to make compiler happy ...
outString->append( buf, (int)strlen( buf ) );
//*ME: warning C4267: convert 'size_t' to 'int'
//*ME: Int-Cast to make compiler happy ...
outString->append( buf, (int)strlen( buf ) );
}
++i;
}
else