Backported indent-encoding fix.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 13 May 2012 02:12:25 +0000 (04:12 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 13 May 2012 02:12:25 +0000 (04:12 +0200)
wrw/sp/util.py

index 96e9880..f387f1c 100644 (file)
@@ -183,18 +183,21 @@ class indenter(formatter):
         reind = False
         if not self.simple(el):
             sub = self.update(curind=self.curind + self.indent)
-            sub.out.indent(sub.curind)
+            sub.reindent()
             reind = True
         for ch in el.children:
             sub.node(ch)
         if reind:
-            self.out.indent(self.curind)
+            self.reindent()
         self.endtag(el)
 
     def element(self, el, **extra):
         super(indenter, self).element(el, **extra)
         if self.out.col > 80 and self.simple(el):
-            self.out.indent(self.curind)
+            self.reindent()
+
+    def reindent(self):
+        self.out.indent(self.curind.encode(self.charset))
 
     def start(self):
         super(indenter, self).start()