[Image-SIG] ImageFont Unicode Decode error

Fredrik Lundh fredrik at pythonware.com
Wed Jan 2 22:22:41 CET 2008

I wrote:

> a glitch, at least.  the _imagingft driver appears to use Python's 
> default encoding, rather than the filename encoding.
> should be relatively easy to fix, I think

For the record, here's a (preliminary) patch:

$ svn diff _imagingft.c
Index: _imagingft.c
--- _imagingft.c        (revision 3349)
+++ _imagingft.c        (working copy)
@@ -117,9 +118,17 @@
      static char* kwlist[] = {
          "filename", "size", "index", "encoding", NULL
+#if defined(HAVE_UNICODE)
+    if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|is", kwlist,
+                                     Py_FileSystemDefaultEncoding, 
+                                     &size, &index, &encoding))
+        return NULL;
      if (!PyArg_ParseTupleAndKeywords(args, kw, "si|is", kwlist,
                                       &filename, &size, &index, &encoding))
          return NULL;

      if (!library && FT_Init_FreeType(&library)) {


More information about the Image-SIG mailing list