From: <ai...@us...> - 2010-04-29 04:57:18
|
Revision: 10949 http://plplot.svn.sourceforge.net/plplot/?rev=10949&view=rev Author: airwin Date: 2010-04-29 04:57:12 +0000 (Thu, 29 Apr 2010) Log Message: ----------- Fix a bug discovered by running examples/python/test_type1.py (which for non-Type1 unicode devices simply plots the first 256 unicode glyphs) for -dev svg. The result was an svg file with unicode characters that are invalid (anything less than 0x20 except for 0x9 [horizontal tab], 0xa [line feed], and 0xd [carriage return]) for XML according to http://www.w3.org/TR/REC-xml/#NT-Char. The result was the file did not validate, and "display" of the file completely failed to work. The fix was simple; replace all invalid characters with a blank. Modified Paths: -------------- trunk/drivers/svg.c Modified: trunk/drivers/svg.c =================================================================== --- trunk/drivers/svg.c 2010-04-29 04:34:29 UTC (rev 10948) +++ trunk/drivers/svg.c 2010-04-29 04:57:12 UTC (rev 10949) @@ -1122,11 +1122,15 @@ * write_unicode () * * writes a unicode character, appropriately formatted (i.e. &#xNNN) + * with invalid xml characters replaced by ' '. * ---------------------------------------------------------------------*/ void write_unicode( FILE *svgFile, PLUNICODE ucs4_char ) { - fprintf( svgFile, "&#x%x;", ucs4_char ); + if ( ucs4_char >= ' ' || ucs4_char == '\t' || ucs4_char == '\n' || ucs4_char == '\r' ) + fprintf( svgFile, "&#x%x;", ucs4_char ); + else + fprintf( svgFile, "&#x%x;", ' ' ); } /*--------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |