mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
__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:
+11
-9
@@ -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("<", out); break;
|
||||
case '>': fputs(">", out); break;
|
||||
case '&': fputs("&", out); break;
|
||||
case '"': fputs(""", out); break;
|
||||
case '\'':fputs("'", out); break;
|
||||
default: putc(c,out); break;
|
||||
case '<': fputs("<", out); break;
|
||||
case '>': fputs(">", out); break;
|
||||
case '&': fputs("&", out); break;
|
||||
case '"': fputs(""", out); break;
|
||||
case '\'': fputs("'", out); break;
|
||||
default: if ( isascii(c) || (c & 0x80) )
|
||||
putc(c, out);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user