better handling of ASCII control chars in xml
represent ASCII control chars as their unicode glyphs in XML see http://www.shacknews.com/chatty?id=37738911#item_37738911
This commit is contained in:
parent
19b27c846e
commit
479610ff30
@ -782,15 +782,14 @@ dbuf_write_amp( VipsDbuf *dbuf, const char *str )
|
|||||||
for( p = str; *p; p++ )
|
for( p = str; *p; p++ )
|
||||||
if( *p < 32 )
|
if( *p < 32 )
|
||||||
/* You'd think we could output "%x;", but xml
|
/* You'd think we could output "%x;", but xml
|
||||||
* 1.0 parsers barf on that. Perhaps we should use '?',
|
* 1.0 parsers barf on that. xml 1.1 allows this, but
|
||||||
* but this is frankly better.
|
* there are almost no parsers.
|
||||||
*
|
*
|
||||||
* xml 1.1 allows this, but expat does not support
|
* U+2400 onwards are unicode glyphs for the ASCII
|
||||||
* it.
|
* control characters, so we can use them -- thanks
|
||||||
*
|
* electroly.
|
||||||
* vips_dbuf_writef( dbuf, "&#x%02x;", *p );
|
|
||||||
*/
|
*/
|
||||||
vips_dbuf_write( dbuf, (guchar *) "🐄", 9 );
|
vips_dbuf_writef( dbuf, "&#x%04x;", 0x2400 + *p );
|
||||||
else if( *p == '<' )
|
else if( *p == '<' )
|
||||||
vips_dbuf_write( dbuf, (guchar *) "<", 4 );
|
vips_dbuf_write( dbuf, (guchar *) "<", 4 );
|
||||||
else if( *p == '>' )
|
else if( *p == '>' )
|
||||||
|
Loading…
Reference in New Issue
Block a user