> hi
>
> I am using freevo 1.7.0 , in a Debian Etch box.
>
> I have huge problems accessing a data CD that I myself burnt
> some time ago.
> The problem is, when I prepared that CD, my locale encoding was set
> to it_IT.ISO-8859-1 , that is, latin-1 encoding ;
> that was the standard in Debian Sarge ; but in Debian Etch,
> the standard is to use UTF-8 encoding.
> So that CD has all accented characters in filenames encoded in latin-1
> and they are wrong.
>
> This CD crashes freevo in many many ways ; I tried
> starting Freevo with it_IT.ISO-8859-1 locale, but it did not work either.
>
> So I tried debugging freevo, and I could identify one crash point
> and fix it (see patch), but could not fix all.
>
> Here is the explanation of why  vfs.py crashes;
> consider those variables as they are set in vfs.py when accessing my CD:
>>>> media.id
> u'2005072211462600lug_05'
>>>> type(media.id)
> <type 'unicode'>
>>>> directory
> 'qu\xe9'
>>>> type(directory)
> <type 'str'>
>>>> media.id+directory
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 2:
> ordinal not in range(128)
>
> The problem  is this: the media.id object is an
> unicode python object, whereas the directory is a raw string containing
> latin-1 stuff : when concatenating, Python tries to promote
> the directory to Unicode, and fails.
>
> My patch is a workaround to the problem: indeed
>>>> str(media.id)+directory
> '2005072211462600lug_05qu\xe9'
> works fine.
>
> My attached patch is a workaround, but is not the correct way
> to act. The correct way is to avoid using the Unicode python type
> for data that may eventually be used for filenames.
> Using the Unicode  python type for file&directory names is a bad bad idea:
> it will crash whenever it will be presented with a filename
> with invalid chars in it.

I agree with you that the media id should be a string and not a unicode
string as you say it's part of a path name.

> BTW my patch does not fix all the problems: another crash I got
> was
>  File "/usr/lib/python2.4/site-packages/freevo/item.py", line 288, in
> set_url
>     audiocover =
> util.getimage(os.path.dirname(self.filename)+'/'+filemask)
> UnicodeDecodeError: 'utf8' codec can't decode bytes in position 38-39:
> unexpected end of data

is the filename or the filemask in unicode and what do they contain?
print 'filename=%r, filemask=%r' % (self.filename, filemask)
will tell you the type and the bytes.

> So, dow do we fix those problems?

Really need to reproduce the problem to fix it effectively.

> For example, where in mmpython should we intervene to avoid
> that media.id be an Unicode string?

kaa.metadata, mmpython is an alias, best is to do a grep in the metadata
source for id. Dischi will know what needs to be changed to get the
media.id as a string.

Duncan


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to