__mkd_xml() was stripping all non-printable ascii from the output, which

meant that it was also stripping all multibyte utf-8 from the output.
Since all the parts of a multibyte utf-8 character have bit 0x80 set,
pass those characters through.
This commit is contained in:
David Parsons
2009-04-30 08:47:34 -07:00
parent 7392e4f5b7
commit 95750433b5
2 changed files with 20 additions and 9 deletions
+11 -9
View File
@@ -152,18 +152,20 @@ mkd_cleanup(Document *doc)
void
___mkd_xml(char *p, int size, FILE *out)
{
char c;
unsigned char c;
while ( size-- > 0 ) {
if ( !isascii(c = *p++) )
continue;
c = *p++;
switch (c) {
case '<': fputs("&lt;", out); break;
case '>': fputs("&gt;", out); break;
case '&': fputs("&amp;", out); break;
case '"': fputs("&quot;", out); break;
case '\'':fputs("&apos;", out); break;
default: putc(c,out); break;
case '<': fputs("&lt;", out); break;
case '>': fputs("&gt;", out); break;
case '&': fputs("&amp;", out); break;
case '"': fputs("&quot;", out); break;
case '\'': fputs("&apos;", out); break;
default: if ( isascii(c) || (c & 0x80) )
putc(c, out);
break;
}
}
}
+9
View File
@@ -41,4 +41,13 @@ else
./echo "ok"
fi
./echo -n ' xml output with multibyte utf-8 .. '
if ./echo 'tecnología y servicios más confiables' | ./markdown -fcdata | grep 'tecnología y servicios más confiables' >/dev/null; then
./echo "ok"
else
./echo "FAILED"
rc=1
fi
exit $rc