Source

thg-qt-mq / losslesslocalstr-more.diff

# HG changeset patch
# Parent 3b25fe7eca71fc7e9e9a604011b6dbcb5f6b7fc7

diff --git a/tortoisehg/util/hglib.py b/tortoisehg/util/hglib.py
--- a/tortoisehg/util/hglib.py
+++ b/tortoisehg/util/hglib.py
@@ -64,7 +64,8 @@ def fromunicode(s, errors='strict'):
         except UnicodeEncodeError:
             pass
 
-    return s.encode(_encoding, errors)  # last ditch
+    # XXX Matt comments this case "can't round-trip", at encoding.tolocal()
+    return encoding.localstr(s.encode('utf-8'), s.encode(_encoding, errors))
 
 def toutf(s):
     """