rcltex: try to detect character encoding

This commit is contained in:
Jean-Francois Dockes 2019-08-27 08:32:50 +02:00
parent e0d300ff58
commit e4576fc12f

View File

@ -77,6 +77,16 @@ umask 77
# !! Leave the following line unmodified !
#ENDRECFILTCOMMONCODE
# Try to detect encoding
encoding=`egrep '\usepackage\[.*\]{inputenc}' "$infile" | \
sed -e 's/.*\[//' -e 's/\].*//'`
if test "X$encoding" = X ; then
encoding=latin1
fi
if test "X$encoding" = Xutf8x ; then
encoding=utf8
fi
if iscmd detex ; then
checkcmds iconv
CMD="detex -n -e ''"
@ -93,7 +103,7 @@ cat <<EOF
EOF
$CMD "$infile" | \
iconv -c -f iso-8859-1 -t utf-8 | \
iconv -c -f "$encoding" -t utf-8 | \
sed -e 's/</&lt;/g' -e 's/&/&amp;/g'
echo '</pre></body></html>'