On 4/23/07, Ehud Karni <[EMAIL PROTECTED]> wrote:
On Mon, 23 Apr 2007 12:24:54 Geoffrey S. Mendelson wrote:
>
> On Mon, Apr 23, 2007 at 11:38:35AM Hadar wrote:
>
> > I'm encoding audio CDs into FLAC files using Sound Juicer.
> > The albums are automatically recognized and the songs names are
downloaded.
> > When ripping Hebrew albums, the songs names are sometimes malformed
> > (a.k.agibberish - certainly not Hebrew characters).
>
> They are Hebrew characters, but not in a charcter set you expect them to
> be.
I prefer the file name to be in ISO-8859-8 (8 bits) and not UTF-8.
Then I can see the Hebrew in Emacs and xterm, but not in Gnome or KDE
applications. I assume you get your Hebrew name in either ISO-8859-8
or in PC DOS (CP856). I have 2 small shell scripts (below) that
converts ALL Hebrew names in a directory tree to ISO-8859-8 / UTF-8.
Thanks for the scripts!
If I understand you correctly, trns-heb-2-utf.sh is what I need.
When I tried it on a directory, it simply wiped down the Hebrew characters.
Here's some debugging info:
+ for DFL in '*'
+ case "$DFL" in
++ echo '01 - çãùåú îäéøç.ogg'
++ tr '[-]' '[ת-א]'
++ iconv -fhebrew -tutf8
iconv: illegal input sequence at position 5
Looks like the input text is not iso-8859-8 (HEBREW) encoded.
I played with iconv a little but couldn't find the appropriate encoding.
Any suggestion?
Ehud.
#! /bin/sh -e
# Translate all file names in this directory tree to iso-8859-8
# -------------------------------------------------------------
chk_nm ()
{
echo "\n\n---- now working on" `pwd`
for DFL in *
do
case "$DFL" in
*"�"* ) # 0xD7 is a sign for Hebrew
UTF-8
NDFL=`echo "$DFL" | iconv -futf8 -thebrew` ;;
* ) # NOT UTF-8, DOS Hebrew is
0x80-0x9A
NDFL=`echo "$DFL" | tr "[-]" "[ת-א]"` ;;
esac
if [ "$DFL" != "$NDFL" ] ; then # name has changed ?
mv "$DFL" "$NDFL" # rename
echo "++++ $DFL ==> $NDFL" # show to user
DFL="$NDFL" # for recursive checking
fi
if [ ! -L "$DFL" -a -d "$DFL" ] ; then
( cd "$DFL" ; chk_nm )
fi
done
}
chk_nm # start scanning
############################## trns-utf-2-heb.sh##############################
#! /bin/sh -e
# Translate all file names in this directory tree to utf-8
# --------------------------------------------------------
chk_nm ()
{
echo "\n\n---- now working on" `pwd`
for DFL in *
do
case "$DFL" in
*"�"* ) ;; # 0xD7 is a sign for Hebrew
UTF-8
* ) # NOT UTF-8, DOS Hebrew is
0x80-0x9A
NDFL=`echo "$DFL" | tr "[-]" "[ת-א]" | iconv -fhebrew
-tutf8`
if [ "$DFL" != "$NDFL" ] ; then # had any Hebrew ?
mv "$DFL" "$NDFL" # rename
echo "++++ $DFL ==> $NDFL" # show to user
DFL="$NDFL" # for recursive
checking
fi ;;
esac
if [ ! -L "$DFL" -a -d "$DFL" ] ; then
( cd "$DFL" ; chk_nm )
fi
done
}
chk_nm # start scanning
############################## trns-heb-2-utf.sh##############################
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry