[PATCH] minirst: make substitutions be unicode, as they are used on unicode data

Matt Mackall mpm at selenic.com
Fri Jun 13 14:12:45 CDT 2014


On Fri, 2014-06-13 at 07:50 -0400, Augie Fackler wrote:
> On Jun 12, 2014, at 3:35 PM, Matt Mackall <mpm at selenic.com> wrote:
> 
> > On Sat, 2014-06-07 at 15:52 -0400, Augie Fackler wrote:
> >> # HG changeset patch
> >> # User Augie Fackler <raf at durin42.com>
> >> # Date 1402170658 14400
> >> #      Sat Jun 07 15:50:58 2014 -0400
> >> # Node ID efe7c79ca21edbdc2aeb83e60335c6d89294f3db
> >> # Parent  7afe70a5d2ad5b22c21ba9be849451407c1f337f
> >> minirst: make substitutions be unicode, as they are used on unicode data
> >> 
> >> Caught this while working to try and get 'hg help' working in Python 3.
> > 
> > Huh. Something changed here then. Every once in a while I add this to
> > hg:
> > 
> > reload(sys)
> > sys.setdefaultencoding("undefined")
> > 
> > ..and clean up the resulting breakage[1]. At one point, I fixed this
> > precise thing.. in the other direction:
> 
> Could we add support for an HGUNICODEPEDANTRY environment variable that would do this before importing most of hg? Then we could (optionally) run a buildbot with that on. I'd be happy to write the patch if you're OK with that as an approach.

Sure.

> >    utext = text.decode(encoding.encoding)
> >    for f, t in substs:
> >        utext = utext.replace(f.decode("ascii"), t.decode("ascii"))
> >    return utext.encode(encoding.encoding)
> 
> Ah, okay. I wasn't sure if this was intentional, since it felt like minirst might be doing something strange.

Since I have this fix sitting in my working directory, I'll go ahead and
push it.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list