Bugs item #1621271, was opened at 2006-12-23 14:56
Message generated for change (Comment added) made by duncanwebb
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1621271&group_id=46652
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.x svn
>Status: Pending
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Gorka Olaizola (gorka)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unicode error inserting a CDR
Initial Comment:
I inserted a CDR with some mp3 and get this traceback. My system is configured
with the locale es_ES.UTF-8 and the /etc/fstab uses utf8 too for the cdrom
/dev/hda /media/dvd iso9660 user,noauto,utf8 0 0
I checked with the program "convmv" that the files have correct UTF-8
characters.
<pre>
Exception in thread Thread-2:
Traceback (most recent call last):
File "threading.py", line 442, in __bootstrap
self.run()
File "/usr/lib/python2.4/site-packages/freevo/plugins/rom_drives.py", line
736, in run
self.check_all()
File "/usr/lib/python2.4/site-packages/freevo/plugins/rom_drives.py", line
696, in check_all
self.identify(media)
File "/usr/lib/python2.4/site-packages/freevo/plugins/rom_drives.py", line
547, in identify
video_files = util.match_files(media.mountdir, config.VIDEO_SUFFIX)
File "/usr/lib/python2.4/site-packages/freevo/util/fileops.py", line 203, in
match_files
files = [ vfs.join(dirname, fname) for fname in os.listdir(dirname) if
File "/usr/lib/python2.4/site-packages/freevo/util/vfs.py", line 79, in
isfile overlay = getoverlay(name)
File "/usr/lib/python2.4/site-packages/freevo/util/vfs.py", line 55, in
getoverlay
return '%s/disc/%s%s' % (config.OVERLAY_DIR, media.id, directory)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 26:
ordinal not in range(128)
</pre>
----------------------------------------------------------------------
>Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-25 22:10
Message:
Logged In: YES
user_id=104395
Originator: NO
I think it is ok
directory='/The Kelly Family - Growin\xc2\xb4 up'
is a string with utf-8 characters which should be the bytes of the
directory name.
File and directory names need to be stored as native strings and then
converted when displayed. The same file name on a disk with latin1 encoding
would appear differently.
If the directory string was shown with a u before the first quote then it
would indicate a problem as it says the string is a unicode string.
The change to site.py makes sense, it should be latin-1 (or maybe utf-8)
----------------------------------------------------------------------
Comment By: Gorka Olaizola (gorka)
Date: 2006-12-24 23:35
Message:
Logged In: YES
user_id=309801
Originator: YES
It seems that changing config.LOCALE did nothing. The change that worked
was to change /etc/site.py for latin-1. Sorry for the confusion.
I copied the files to a directory and without changing /etc/site.py it
works so maybe something is wrong in the code that reads directories from
the CD
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-24 13:54
Message:
Logged In: YES
user_id=104395
Originator: NO
It is best to have LOCALE='latin-1' set in local_conf.py because of the
way String and Unicode functions work, IIRC they use the LOCALE setting
first and then try utf-8, so there is no point in setting LOCAL='utf-8'.
In fact '/The Kelly Family - Growin\xc2\xb4 up' is a utf-8 string, which
when converted to unicode is 'u/The Kelly Family - Growin´ up'. \xc2\xb4
is a back quote which is a non-ascii character.
Good to see you have a solution for this.
----------------------------------------------------------------------
Comment By: Gorka Olaizola (gorka)
Date: 2006-12-24 11:49
Message:
Logged In: YES
user_id=309801
Originator: YES
This is the output of the print statement.
OVERLAY_DIR='/var/cache/freevo/vfs'
media.id=u'fedd76ec67048c80d87d80ed8b67a68fKelly_Family_MP3'
directory='/The Kelly Family - Growin\xc2\xb4 up'
I think the directory has utf-8 characters. This is correct as my system
locale is UTF-8
If I change the encoding in /etc/python2.4/site.py to latin1 it works.
If I change config.LOCALE to latin1 instead of utf-8, that I think I had
incorrectly, it works.
So it seems a problem with my config.
----------------------------------------------------------------------
Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-23 19:35
Message:
Logged In: YES
user_id=104395
Originator: NO
Will you add before line 55 a print statement, something like:
print 'OVERLAY_DIR=%r' % config.OVERLAY_DIR, 'media.id=%r' % media.id,
'directory=%r' % directory
More than likely the directory has a non-ascii character.
There are two possibilities here
1) set encoding in site.py to either utf-8 or iso-8859-1, possible utf-8.
2) add a try: except UnicodeError: block around line 55 and call
String(directory), etc. in the except block.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1621271&group_id=46652
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel