Commits

Joe Walker committed 592f13a

fix additional utf-8 problem

  • Participants
  • Parent commits 9ab9fa9

Comments (0)

Files changed (1)

backend/python/bespin/mobwrite/integrate.py

         try:
             (project, path) = self._split(name)
             log.debug("loading temp file for: %s/%s" % (project.name, path))
-            return project.get_temp_file(path)
+            bytes = project.get_temp_file(path)
+            # mobwrite gets things into unicode by doing bytes.encode("utf-8")
+            # which uses the 'strict' error handling technique, which raises
+            # on failure. Since we're not tracking content-type on the server
+            # we could have anything at this point so, and we don't want to die
+            # so we fudge the issue by ignoring things that are not utf-8
+            return bytes.decode("utf-8", "ignore")
         except:
             log.exception("Error in Persister.load() for name=%s", name)
             return ""