encoding: handle empty string in toutf8
authorMatt Mackall <mpm@selenic.com>
Mon, 15 Sep 2014 13:12:20 -0500
changeset 22425 6fd944c204a9
parent 22424 1f72226064b8
child 22426 f6b533e64ed6
encoding: handle empty string in toutf8
mercurial/encoding.py
--- a/mercurial/encoding.py	Fri Sep 12 19:06:11 2014 -0500
+++ b/mercurial/encoding.py	Mon Sep 15 13:12:20 2014 -0500
@@ -336,8 +336,8 @@
         return s._utf8
 
     try:
-        if s.decode('utf-8'):
-            return s
+        s.decode('utf-8')
+        return s
     except UnicodeDecodeError:
         # surrogate-encode any characters that don't round-trip
         s2 = s.decode('utf-8', 'ignore').encode('utf-8')