Index: vcpx/repository/darcs/source.py
===================================================================
--- vcpx/repository/darcs/source.py	(revision 1371)
+++ vcpx/repository/darcs/source.py	(revision 1384)
@@ -125,5 +125,5 @@
 
 def changesets_from_darcschanges(changes, unidiff=False, repodir=None,
-                                 chunksize=2**15):
+                                 chunksize=2**15, replace_badchars=None):
     """
     Parse XML output of ``darcs changes``.
@@ -136,10 +136,11 @@
 
     csets = changesets_from_darcschanges_unsafe(changes, unidiff,
-                                                repodir, chunksize)
+                                                repodir, chunksize,
+                                                replace_badchars)
     for cs in csets:
         yield cs
 
 def changesets_from_darcschanges_unsafe(changes, unidiff=False, repodir=None,
-                                        chunksize=2**15):
+                                        chunksize=2**15, replace_badchars=None):
     """
     Do the real work of parsing the change log, including tags.
@@ -241,5 +242,12 @@
     parser.setErrorHandler(ErrorHandler())
 
-    chunk = changes.read(chunksize)
+    def fixup_badchars(s, map):
+        if not map:
+            return s
+
+        ret = [map.get(c, c) for c in s]
+        return "".join(ret)
+
+    chunk = fixup_badchars(changes.read(chunksize), replace_badchars)
     while chunk:
         parser.feed(chunk)
@@ -247,5 +255,5 @@
             yield cs
         handler.changesets = []
-        chunk = changes.read(chunksize)
+        chunk = fixup_badchars(changes.read(chunksize), replace_badchars)
     parser.close()
     for cs in handler.changesets:
@@ -309,5 +317,5 @@
                 #    my ($date, $author) = ($1, $2);
                 # but that assumes the two spaces as separator, so I find the
-                # following solution easier and by any chance faster too.                
+                # following solution easier and by any chance faster too.
                 pieces = l.rstrip().split('  ')
                 assert len(pieces)>1, "Cannot parse %r as a patch timestamp" % l
@@ -418,5 +426,6 @@
                                       "--xml-output", "--summ")
         changes = ExternalCommand(cwd=self.repository.basedir, command=cmd)
-        last = changesets_from_darcschanges(changes.execute(stdout=PIPE)[0])
+        last = changesets_from_darcschanges(changes.execute(stdout=PIPE)[0],
+                                            replace_badchars=self.repository.replace_badchars)
         try:
             changeset.entries.extend(last.next().entries)
@@ -470,5 +479,5 @@
                          output and output.read() or ''))
 
-                csets = changesets_from_darcschanges(output)
+                csets = changesets_from_darcschanges(output, replace_badchars=self.repository.replace_badchars)
                 changeset = csets.next()
 
@@ -532,5 +541,5 @@
                 (str(changes), changes.exit_status, output.read()))
 
-        last = changesets_from_darcschanges(output)
+        last = changesets_from_darcschanges(output, replace_badchars=self.repository.replace_badchars)
 
         return last.next()
