Handle garbled unrtf http-equiv header causing pbs with html5 handler

This commit is contained in:
Jean-Francois Dockes 2012-01-26 19:30:43 +01:00
parent ec87379015
commit fde36ecccc
2 changed files with 4 additions and 2 deletions

View File

@ -83,6 +83,7 @@ checkcmds awk unrtf
# output the result
# The strange 'BEGIN' setup is to prevent 'file' from thinking this file
# is an awk program
# The thing about the charset is that unrtf outputs a garbled one.
unrtf --nopict --html "$infile" 2> /dev/null |
awk 'BEGIN'\
' {
@ -90,10 +91,11 @@ awk 'BEGIN'\
}
/<\/head>/{
if (gothead == 0) {
printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n")
printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n")
gothead = 1
}
}
/<meta http-equiv=/{next}
{
print
}

View File

@ -99,7 +99,7 @@ message/rfc822 = internal
text/calendar = execm rclics;mimetype=text/plain;charset=utf-8
text/html = internal
text/plain = internal
text/rtf = exec unrtf --nopict --html;charset=iso-8859-1;mimetype=text/html
text/rtf = exec unrtf --nopict --html;mimetype=text/html
text/x-c = internal
text/x-c++ = internal
text/x-c+ = internal