* Artur R. Czechowski <[EMAIL PROTECTED]> [2005-11-19 15:12]: With > unusable_chars:[' ', '\xc4\x85', ... you get > Tagging.Traceback (most recent call last): > File "/usr/bin/jack", line 269, in ? > jack_tag.tag(freedb_rename) > File "/usr/lib/python2.3/site-packages/jack_tag.py", line 205, in tag > newname = string.replace(newname, cf['_unusable_chars'][char_i], > cf['_replacement_chars'][char_i]) > File "/usr/lib/python2.3/string.py", line 370, in replace > return s.replace(old, new, maxsplit) > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 0: > ordinal not in range(128)
> I tested it with LC_CTYPE set to pl_PL.UTF-8 and to pl_PL. Yes, I can reproduce this. Below is a fix; it definitely works in UTF. Can you please also test it in pl_PL? --- /usr/lib/python2.3/site-packages/jack_tag.py~ 2005-11-19 14:47:23.000000000 +0000 +++ /usr/lib/python2.3/site-packages/jack_tag.py 2005-11-19 15:06:54.000000000 +0000 @@ -202,7 +202,13 @@ newname = jack_misc.multi_replace(cf['_rename_fmt'], replacelist) exec("newname = newname" + cf['_char_filter']) for char_i in range(len(cf['_unusable_chars'])): - newname = string.replace(newname, cf['_unusable_chars'][char_i], cf['_replacement_chars'][char_i]) + try: + a = unicode(cf['_unusable_chars'][char_i], locale.getpreferredencoding(), "replace") + b = unicode(cf['_replacement_chars'][char_i], locale.getpreferredencoding(), "replace") + except UnicodeDecodeError: + warning("Cannot substitute unusable character %d." % (char_i+1)) + else: + newname = string.replace(newname, a, b) try: i[NAME] = unicode(i[NAME], "utf-8") except UnicodeDecodeError: -- Martin Michlmayr http://www.cyrius.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]