Package: jack / 3.1.1+cvs20050801-31

68_support_high_char_renames.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Allow characters >128 in unusable_chars and replacement_chars.
Debian #339879.

--- a/jack_tag.py~	2005-11-19 14:47:23.000000000 +0000
+++ b/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: