Hi

Dne Wed, 11 Mar 2009 09:39:33 -0400
Andreas Klöckner <[email protected]> napsal(a):

> On Mittwoch 11 März 2009, Michal Čihař wrote:
> > Hi
> >
> > Do you have any plans to make tagpy work with unicode file names? In
> > Debian I just got following bug report for that.
> 
> No, I don't think so. On Unix (Linux), the reality is that a filename is a 
> bunch of bytes. Any encoding on top of it is an illusion that's maintained 
> for 
> the user's sake, but it breaks far too often on 'practical' filesystems to be 
> something I'd include in an API of mine. If an app on top of tagpy wants to 
> support that illusion, they need to deal with the complexity arising from it. 
> (Glib has code for that, for example) Taglib seems to agree, btw.

But Python does not agree:

Dne Wed, 11 Mar 2009 19:55:40 +0200
Adam Szojda <[email protected]> napsal(a):

> On Wed, Mar 11, 2009 at 02:50:11PM +0100, Michal Čihař wrote:
> > 
> > What is correct according to upstream, your application should take
> > care of conversion unicode sting to whatever is proper representation
> > of it on filesystem.
> > 
> 
> Oh. Strange. That illusion seems to be supported by the Python itself:
> 
> $ python
> Python 2.5.2 (r252:60911, Jan  4 2009, 21:59:32)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> f = open(u"łä.mp3", "rb")
> >>> f
> <open file u'\u0142\xe4.mp3', mode 'rb' at 0x7f8c25faca08>
> 
> >>> for i in os.listdir(u'.'):
> ...     if i[-3:] == u"mp3":
> ...             print i
> ...
> łä.mp3
> 
> and using non-latin chars:
> 
> >>> f = open(u"चीन.mp3", "w")
> >>> f
> <open file u'\u091a\u0940\u0928.mp3', mode 'w' at 0x7f3520079cd8>
> >>> for i in os.listdir(u"."):
> ...     if i[-3:] == u"mp3":
> ...             print i
> ...
> łä.mp3
> चीन.mp3
> 
> So basicly, one can write an app in python that's using unicode
> for everyting, including filenames and will be forsed to recode
> them manually to filesystem encoding for tagpy.


-- 
        Michal Čihař | http://cihar.com | http://blog.cihar.com

Attachment: signature.asc
Description: PGP signature

Reply via email to