leosongwei / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
0 stars 0 forks source link

Default encoding for text frames is ISO 8859-1 #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When setting text frames (like the title) using EasyID3, the encoding is
set to ISO 8859-1 (or Latin 1).

id3 = EasyID3(filename)
id3['title'] = title

If the title contains characters that are not in ISO 8859-1, such as
en-dash (–), EncodedTextSpec.write() will throw a UnicodeEncodeError, which
is not caught.

Since the setter method in EasyID3.RegisterTextKey sets encoding = 3 on
KeyError, why not set encoding = 3 for known frames? There is probably a
better way to do this, but I fixed it by adding this line in the else
clause of the setter:

frame.encoding = 3

Also, maybe we should use an 'ignore' or 'replace' flag for value.encode()
in EncodedTextSpec.write()?

Original issue reported on code.google.com by cy...@home.se on 18 Jan 2010 at 10:10

GoogleCodeExporter commented 9 years ago
No, the behavior should be to throw an error. This is a bug, and should be 
fixed -
the encoding should be set to UTF-16 as you suggest when you change the key.

Original comment by joe.wreschnig@gmail.com on 18 Jan 2010 at 12:25

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r80.

Original comment by joe.wreschnig@gmail.com on 5 Feb 2010 at 5:23