[BUG_FIXED]Fix the bug that Unicode path file opened in the previous session doesn't be restored.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@368 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-12-14 22:30:57 +00:00
parent 2b0cfc133f
commit e11530f0c0
2 changed files with 9 additions and 25 deletions

View File

@ -92,7 +92,7 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
// Easy pass at non-alpha/numeric/symbol
// 127 is the delete key. Below 32 is symbolic.
TCHAR buf[ 32 ];
wsprintf( buf, TEXT("&#x%02X;"), (unsigned) ( c & 0xff ) );
wsprintf( buf, TEXT("&#x%04X;"), (unsigned) ( c & 0xffff ) );
outString->append( buf, lstrlen( buf ) );
++i;
}

View File

@ -223,36 +223,20 @@ const TCHAR* TiXmlBase::ReadName( const TCHAR* p, TIXML_STRING * name )
const TCHAR* TiXmlBase::GetEntity( const TCHAR* p, TCHAR* value )
{
// Presume an entity, and pull it out.
TIXML_STRING ent;
int i;
// Handle the &#x entities.
if ( generic_strncmp( TEXT("&#x"), p, 3 ) == 0
&& *(p+3)
&& *(p+4)
&& ( *(p+4) == ';' || *(p+5) == ';' )
)
if (generic_strncmp( TEXT("&#x"), p, 3 ) == 0)
{
*value = 0;
if ( *(p+4) == ';' )
const TCHAR* end = generic_strchr(p+3, TEXT(';'));
if (end && end - p <= 3 + 4)
{
// Short, one value entity.
if ( isalpha( *(p+3) ) ) *value += ( tolower( *(p+3) ) - 'a' + 10 );
else *value += ( *(p+3) - '0' );
return p+5;
}
else
int val;
if (generic_sscanf(p+3, TEXT("%x"), &val) == 1)
{
// two value entity
if ( isalpha( *(p+3) ) ) *value += ( tolower( *(p+3) ) - 'a' + 10 ) * 16;
else *value += ( *(p+3) - '0' ) * 16;
if ( isalpha( *(p+4) ) ) *value += ( tolower( *(p+4) ) - 'a' + 10 );
else *value += ( *(p+4) - '0' );
return p+6;
*value = val;
return end + 1;
}
}
}