Code

lyrics: print text in UTF-8
authorMax Kellermann <max@duempel.org>
Tue, 23 Sep 2008 11:41:49 +0000 (13:41 +0200)
committerMax Kellermann <max@duempel.org>
Tue, 23 Sep 2008 11:41:49 +0000 (13:41 +0200)
Python defaults to sending ASCII characters, and aborts if there are
non-ASCII characters in the string.  Unfortunately, due to "C.UTF-8"
being not defined, we cannot reliably make Python use UTF-8, without
further locale settings.  Thus, work around this mess by manually
encoding the result to UTF-8 in the script.

lyrics/leoslyrics.py

index 0cee65aee4edcea651996c4960e7238b78f56867..1e8975910619bb7e2c5dec978f3d240247f44ad4 100755 (executable)
@@ -65,4 +65,4 @@ def lyrics(hid):
 hid = search(argv[1], argv[2])
 if hid is None:
     exit(2)
-print lyrics(hid)
+print lyrics(hid).encode('utf-8')