diff --git a/fulltests/OperaMarketShareEEhover.svg b/fulltests/OperaMarketShareEEhover.svg
new file mode 100644
index 0000000..73b75d7
--- /dev/null
+++ b/fulltests/OperaMarketShareEEhover.svg
@@ -0,0 +1,685 @@
+
+
\ No newline at end of file
diff --git a/package.sh b/package.sh
index e417883..57fa727 100755
--- a/package.sh
+++ b/package.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-SCOURVER="0.10"
+SCOURVER="0.11"
cd ..
tar cvf scour/tarballs/scour-$SCOURVER.tar scour/scour.py scour/svg_regex.py scour/LICENSE scour/NOTICE scour/README.txt scour/release-notes.html
gzip scour/tarballs/scour-$SCOURVER.tar
diff --git a/scour.py b/scour.py
index 28f970c..a21af7f 100755
--- a/scour.py
+++ b/scour.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
# Scour
#
@@ -71,7 +72,7 @@ from decimal import *
getcontext().prec = 6
APP = 'scour'
-VER = '0.10'
+VER = '0.11'
COPYRIGHT = 'Copyright Jeff Schiller, 2009'
NS = { 'SVG': 'http://www.w3.org/2000/svg',
@@ -1046,7 +1047,7 @@ def scourXmlFile(filename, options=[]):
# print 'IN=',in_string
out_string = scourString(in_string, options)
# print 'OUT=',out_string
- return xml.dom.minidom.parseString(out_string)
+ return xml.dom.minidom.parseString(out_string.encode('utf-8'))
def printHeader():
print APP , VER
@@ -1119,7 +1120,7 @@ if __name__ == '__main__':
# do the work
in_string = input.read()
out_string = scourString(in_string, options)
- output.write(out_string)
+ output.write(out_string.encode("utf-8"))
# Close input and output files
input.close()
diff --git a/testscour.py b/testscour.py
index fe98e51..bbf7d10 100755
--- a/testscour.py
+++ b/testscour.py
@@ -1,4 +1,6 @@
-#!/usr/local/bin/python
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
# Test Harness for Scour
#
# Copyright 2009 Jeff Schiller
@@ -492,6 +494,12 @@ class ChangeLineToVerticalLineSegmentInPath(unittest.TestCase):
self.assertEquals(path[2][1][0], 100.0,
'Did not calculate vertical line segment in path correctly' )
+class HandleNonAsciiUtf8(unittest.TestCase):
+ def runTest(self):
+ doc = scour.scourXmlFile('unittests/utf8.svg')
+ desc = unicode(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
+ self.assertEquals( desc, u'ú',
+ 'Did not handle non-ASCII characters' )
if __name__ == '__main__':
unittest.main()
diff --git a/unittests/utf8.svg b/unittests/utf8.svg
new file mode 100644
index 0000000..2fd0ce2
--- /dev/null
+++ b/unittests/utf8.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file