Re: [frogs] [patch] convert-ly cannot deal with accented characters

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


On Thu, Mar 4, 2010 at 4:35 PM, Valentin Villenave
<v.villenave@xxxxxxxxx> wrote:
> Here's the patch; one of you guys may have a better idea of how to
> deal with it. As for me, I'm just plain stuck.
> http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=patch;h=0ce2657b47ac6ba152ee022b27de26e569846db9

Dude, don't be lazy.  Here's the actual bits:

--------
diff --git a/python/lilylib.py b/python/lilylib.py
index 3bdfa1c..9915cd7 100644
--- a/python/lilylib.py
+++ b/python/lilylib.py
@@ -23,6 +23,7 @@ import re
 import shutil
 import sys
 import optparse
+import locale

 ################################################################
 # Users of python modules should include this snippet
@@ -48,7 +49,9 @@ underscore = _
 # Maybe guess encoding from LANG/LC_ALL/LC_CTYPE?

 def encoded_write(f, s):
-    f.write (s.encode (f.encoding or 'utf_8'))
+    f.write (s
+      .decode (sys.stderr.encoding or locale.getdefaultlocale()[1])
+      .encode (f.encoding or 'utf_8'))

 # ugh, Python 2.5 optparse requires Unicode strings in some argument
 # functions, and refuse them in some other places
-----------

Now, have you tried a doc build to see the error yourself?  What part
of this patch is causing the problem?  Can you avoid using that part?

I expect my 1st year students to go "duh, it doesn't work".  You can
do better than them.

- Graham

---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/