Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#110 Strange behaviour of TiXmlBase::EncodeString

open
nobody
None
5
2010-08-17
2010-08-17
m82
No

If I write "©" to TinyXML and read this value again, the result is "©". I think you should delete the code section, that I have commented out:

void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
{
int i=0;

while( i<(int)str.length() )
{
unsigned char c = (unsigned char) str[i];

/*if ( c == '&' //auskommentiert, weil eventuell unerwünscht bzw. gefährlich
&& i < ( (int)str.length() - 2 )
&& str[i+1] == '#'
&& str[i+2] == 'x' )
{
// Hexadecimal character reference.
// Pass through unchanged.
// &#xA9; -- copyright symbol, for example.
//
// The -1 is a bug fix from Rob Laveaux. It keeps
// an overflow from happening if there is no ';'.
// There are actually 2 ways to exit this loop -
// while fails (error case) and break (semicolon found).
// However, there is no mechanism (currently) for
// this function to return an error.
while ( i<(int)str.length()-1 )
{
outString->append( str.c_str() + i, 1 );
++i;
if ( str[i] == ';' )
break;
}
}
else*/ if ( c == '&' )
{
outString->append( entity[0].str, entity[0].strLength );
++i;
}

Discussion

  • Bharat
    Bharat
    2012-07-24

    Hi I am looking into it. Assign it to me.