I've used this to give myself some clarity on the subject:
http://farmdev.com/talks/unicode/

The solution I intend to implement:
read in name as a byte string
try: convert to unicode and encode to utf8
fail: replace non unicode / non-utf8 chars with _; log filename; rename file
on disk;


Some other solutions I've found:
conn.text_factory = str # ignore encodings, just store the binary
conn.text_factory = lambda x: unicode(x, "utf-8", errors="ignore") # skip
non-utf8 decodables
conn.text_factory = lambda x: unicode(x, "utf-8", errors="replace") #
replace funky with fffd



Thanks for the suggestion. My ultimate goal is much broader than just my
mp3s. It just so happens that that's where I'm experiencing the problems
right now.

After some more reading and searching it seems that the files which can't be
read ascii or unicode fail because they were copied from an ntfs drive which
uses some other encoding.

There is a way to convert filenames in place using convmv, but I'd have to
know the source encoding for each file, which I don't. Some of these files
came from Albania on a computer that was set in Windows Italian.

AJ ONeal


On Sun, Jun 21, 2009 at 8:06 PM, David Hilton <[email protected]>wrote:

> On Sun, Jun 21, 2009 at 7:28 PM, AJ ONeal <[email protected]> wrote:
>
>> I'd like to know of a batch method of renaming files on the filesystem to
>> utf8 and replacing any non-converting characters to '_'.
>>
>
> May I suggest you take a look at picard?  It will certainly do what you
> want, and a lot more.  IMO, it's the best tool available for filling in
> audio tags and renaming/moving files.
>
> If you use it, I suggest you also install the cover art downloader (
> http://musicbrainz.org/doc/PicardQt/Plugins).
> It really should be included, but oh well.
>
> David
>
> P.S. EAC still beats all other audio rippers (at least on linux and
> windows) at ensuring good rips.  As far as native linux solutions go, rrip
> is as close as you can get, but its results are still inferior - plus it's a
> lot slower and requires more manual configuration.
>
> --------------------
> BYU Unix Users Group
> http://uug.byu.edu/
>
> The opinions expressed in this message are the responsibility of their
> author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG.
> ___________________________________________________________________
> List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list
>
--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to