mercurial/wireproto.py
changeset 13047 6c375e07d673
parent 12703 40bb5853fc4b
child 13049 d588326f6321
--- a/mercurial/wireproto.py	Wed Nov 24 15:38:52 2010 -0600
+++ b/mercurial/wireproto.py	Wed Nov 24 15:56:32 2010 -0600
@@ -44,14 +44,7 @@
             branchmap = {}
             for branchpart in d.splitlines():
                 branchname, branchheads = branchpart.split(' ', 1)
-                branchname = urllib.unquote(branchname)
-                # Earlier servers (1.3.x) send branch names in (their) local
-                # charset. The best we can do is assume it's identical to our
-                # own local charset, in case it's not utf-8.
-                try:
-                    branchname.decode('utf-8')
-                except UnicodeDecodeError:
-                    branchname = encoding.fromlocal(branchname)
+                branchname = encoding.tolocal(urllib.unquote(branchname))
                 branchheads = decodelist(branchheads)
                 branchmap[branchname] = branchheads
             return branchmap
@@ -162,7 +155,7 @@
     branchmap = repo.branchmap()
     heads = []
     for branch, nodes in branchmap.iteritems():
-        branchname = urllib.quote(branch)
+        branchname = urllib.quote(encoding.fromlocal(branch))
         branchnodes = encodelist(nodes)
         heads.append('%s %s' % (branchname, branchnodes))
     return '\n'.join(heads)