ls | while read filename do mv -i "$filename" "`echo "$filename" | iconv -f GB2312 -t UTF8`" done
Or you can use the convmv tool (in fedora) to do that too.
On 08/31/2010 11:18 AM, Jens Petersen wrote:
ls | while read filename do mv -i "$filename" "`echo "$filename" | iconv -f GB2312 -t UTF8`" done
Or you can use the convmv tool (in fedora) to do that too.
Hadn't known about that command. Thanks....
Sometimes the hardest thing is to determine what encoding the file names are in to start. :-(
2010/8/31 Ed Greshko Ed.Greshko@greshko.com: <--SNIP-->
Hadn't known about that command. Thanks....
Sometimes the hardest thing is to determine what encoding the file names are in to start. :-(
-- A tall, dark stranger will have more fun than you. 葛斯克 愛德華 / 台北 市八德路四段
For that purpose there's a powerful utility called enca. From enca man page: If you are lucky enough, the only two things you will ever need to know are: command
enca FILE
will tell you which encoding file FILE uses (without changing it), and
enconv FILE
will convert file FILE to your locale native encoding.
On 08/31/2010 11:54 AM, Hiisi wrote:
2010/8/31 Ed Greshko Ed.Greshko@greshko.com: <--SNIP-->
Hadn't known about that command. Thanks....
Sometimes the hardest thing is to determine what encoding the file names are in to start. :-(
-- A tall, dark stranger will have more fun than you. 葛斯克 愛德華 / 台北 市八德路四段
For that purpose there's a powerful utility called enca. From enca man page: If you are lucky enough, the only two things you will ever need to know are: command
enca FILE will tell you which encoding file FILE uses (without changing it), and enconv FILE will convert file FILE to your locale native encoding.
Well...the man page says "enca -- detect and convert encoding of text files" and we are talking about file names not the contents of the file. I think the problem with detection of the encoding of the file name...and even a text tile contents is that if the number of characters is small (i.e. small sample size) the detection is prone to error.
2010/8/31 Ed Greshko Ed.Greshko@greshko.com:
Sometimes the hardest thing is to determine what encoding the file names are in to start. :-(
<--SNIP-->
Well...the man page says "enca -- detect and convert encoding of text files" and we are talking about file names not the contents of the file. I think the problem with detection of the encoding of the file name...and even a text tile contents is that if the number of characters is small (i.e. small sample size) the detection is prone to error.
-- If you're careful enough, nothing bad or good will ever happen to you. 葛斯克 愛德華 / 台北市八德路四段
Yes, I know. And enconv can be used exactly the same way that iconv used in the proposed script. But you don't have to guess the encoding.
On 08/31/2010 01:32 PM, Hiisi wrote:
Yes, I know. And enconv can be used exactly the same way that iconv used in the proposed script. But you don't have to guess the encoding.
Well, you may still have to guess if the sample size is small such that it can't accurately determine it. In looking at both enca and convmv I noticed that their "--list" options show a subset of the encodings available in iconv. So, while they are very good they may not fill a given need.
Thanks for pointing. I will look at the convmv tool
On Tue, Aug 31, 2010 at 11:18 AM, Jens Petersen petersen@redhat.com wrote:
ls | while read filename do mv -i "$filename" "`echo "$filename" | iconv -f GB2312 -t UTF8`" done
Or you can use the convmv tool (in fedora) to do that too.
users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines