contrib/mrecode: assume UTF-8 for unknown-8bit or x-unknown charsets

pull/180/head
Leah Neukirchen 4 years ago
parent bb8054c2ff
commit a02c7e451b

@ -1,8 +1,8 @@
#!/bin/sh
# mrecode - recode stdin respecting PIPE_CHARSET into UTF-8
if [ -n "$PIPE_CHARSET" ]; then
exec iconv -f "$PIPE_CHARSET" -t UTF-8
else
exec cat
fi
case "$PIPE_CHARSET" in
''|*[Uu][Nn][Kk][Nn][Oo][Ww][Nn]*) exec cat;;
*) exec iconv -f "$PIPE_CHARSET" -t UTF-8;;
esac

Loading…
Cancel
Save