Very small zlib/svg problem

Fedor Baart fedor at mailandnews.com
Wed Mar 27 16:41:26 EST 2002


I am trying to convert a SVG file to a SVGZ file which is the
"gzip"compressed version of the SVG file.
(SVG is a XML based vector graphics format (see www.w3c.org))

I use the zlib library to compress the svg file.

The problem is that when I try to view the SVGZ file with adobe SVG viewer
3.0 or with the Batik SVG browser that it doesn't render and is not able to
read the SVGZ file as SVG.

I am assuming I am not using the zlib library correctly.

I use the following code:

import zlib
file('c:/test.svgz','w').write(zlib.compress(file('c:/test.svg').read()))
#read the svg file c:\test.svg, compress it using zlib and write it to
c:\test.svgz

Opening the test.svgz using a svg compatible browser is supposed to display
the SVG drawing. But it displays nothing. The Batik browser displays an
error: Character conversion error: "Unconvertible UTF-8 character beginning
with 0x9c" (line number may be too low).

Any help would be greatly appreciated.

Thanks,

Fedor Baart

For those who like svg: www2.sfk.nl/svg ---> a python svg module which I
created.





More information about the Python-list mailing list