diff mercurial/encoding.py @ 22425:6fd944c204a9

encoding: handle empty string in toutf8
author Matt Mackall <mpm@selenic.com>
date Mon, 15 Sep 2014 13:12:20 -0500
parents b515c3a63e96
children f6b533e64ed6
line wrap: on
line diff
--- 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')