phabricator: convert unicode to binary when writing patches stable
authorJun Wu <quark@fb.com>
Thu, 27 Jul 2017 12:03:01 -0700
branchstable
changeset 33601 850d2ec2cf6a
parent 33600 47829b89c8c6
child 33602 27fbca750b4d
child 34194 a00580bc135f
phabricator: convert unicode to binary when writing patches This is a quick fix to make `hg phabread D189` work. It seems we might want to replace all `r''` to `u''`, and add more `encoding.*to*` to be more explicit when interacting with `json` module. Differential Revision: https://phab.mercurial-scm.org/D192
contrib/phabricator.py
--- a/contrib/phabricator.py	Thu Jul 27 23:15:14 2017 +0900
+++ b/contrib/phabricator.py	Thu Jul 27 12:03:01 2017 -0700
@@ -560,7 +560,8 @@
             if k in meta:
                 header += '# %s %s\n' % (_metanamemap[k], meta[k])
 
-        write(('%s%s\n%s') % (header, desc, body))
+        content = '%s%s\n%s' % (header, desc, body)
+        write(encoding.unitolocal(content))
 
 @command('phabread',
          [('', 'stack', False, _('read dependencies'))],