diff -r f0c87fb62b66 -r 1928f1a1ee5b extractors/ext-mpg123 --- a/extractors/ext-mpg123 Sat Feb 12 17:03:08 2011 +0300 +++ b/extractors/ext-mpg123 Sat Jun 18 16:11:12 2011 +0400 @@ -1,6 +1,21 @@ #!/bin/sh echo "$1" -mpg123 -vtn1 --long-tag "$1" 2>&1|awk '/^\t.*:/ {match($0,"\t(.*): +(.*)",a); print toupper(a[1])":"a[2]; }' +TFILE=$(mktemp) +TFILE2=$(mktemp) +mpg123 -vtn1 --long-tag "$1" 2>&1|awk '/^\t.*:/ {match($0,"\t(.*): +(.*)",a); print toupper(a[1])":"a[2]; }' > $TFILE +if iconv -s -f utf-8 -t latin1 $TFILE > $TFILE2 && iconv -s -f utf-8 -t utf-8 $TFILE2 > /dev/null; then + echo "ENCODINGHACK:DOUBLE-UTF-8" + cat $TFILE2 +else + if iconv -s -f utf-8 -t latin1 $TFILE > $TFILE2 && iconv -s -f cp1251 -t utf-8 $TFILE2 > /dev/null; then + iconv -s -f cp1251 -t utf-8 $TFILE2 + echo "ENCODINGHACK:CP1251" + else + echo "ENCODING:UTF-8" + cat "$TFILE" + fi +fi +rm -f $TFILE $TFILE2 echo