[cairo] cairo Digest, Vol 52, Issue 21

Carl Worth cworth at cworth.org
Mon Nov 16 15:06:00 PST 2009


On Mon, 16 Nov 2009 16:49:42 +0100, Simon Bächler <sbaechler at me.com> wrote:
> self.basename=self.basename.decode("unicode_escape","ignore")
> self.basename=self.basename.encode("ascii","ignore")
> 
> self.surface2.write_to_png(self.basename)
> 
> Now special characters are just left out which is sad. Apparently the 
> function cannot deal with those.

Strange. The underlying C function:

	cairo_surface_write_to_png (cairo_surface_t     *surface,
	                            const char          *filename)

Takes that filename and just calls:

	FILE *fp = fopen (filename, "wb");

So that should work with pretty much any sequence of bytes you like for
the filename, (as long as it doesn't contain '/' of course).

So perhaps there's a bug somewhere in the python wrapper for this
function.

-Carl


More information about the cairo mailing list