[PATCH 0 of 1] Decode UTF-8 e-mail headers present in git formatted patches

Matt Mackall mpm at selenic.com
Wed Dec 18 15:07:05 CST 2013


On Wed, 2013-11-13 at 22:27 +0100, Rafaël Carré wrote:
> Le 13/11/2013 18:46, Matt Mackall a écrit :
> > On Tue, 2013-11-12 at 11:13 +0100, funman at videolan.org wrote:
> >> This new patch adds a test which is currently failing.
> >>
> >> http://mercurial.selenic.com/wiki/EncodingStrategy#The_encoding_tracking_problem
> >> says user names are 'owned and managed' by Mercurial and should be encoded as UTF-8.
> >>
> >> This seems to not be the case, as HGENCODING=ascii (as used by the testsuite) will 
> >> render the user name 'ë' (0xc3 0xab) as '?'
> > 
> > This is correct: when you tell Mercurial that your terminal only does
> > ASCII, it can't show you an 'ë'.
> > 
> > User names are stored -on disk- as UTF-8, but manipulated and displayed
> > in the local character set, whatever that may be. 
> > 
> >> Is encoding.fromlocal being used? I couldn't figure it out.
> > 
> > Yes. It's here:
> > 
> > http://www.selenic.com/hg/file/c38c3fdc8b93/mercurial/changelog.py#l308
> > 
> >> Having email_decode return an UTF-8 string instead of using tolocal will make the test 
> >> fail with:
> > 
> > You must use tolocal. It is magic and can be made to work _even if the
> > local encoding is ASCII_.
> > 
> > http://www.selenic.com/hg/file/c38c3fdc8b93/mercurial/encoding.py#l61
> > http://mercurial.selenic.com/wiki/EncodingStrategy#Round-trip_conversion
> 
> Thanks, I didn't think that terminal output could be affected.
> 
> In this case how can I write a test for this feature, if the tests only
> output ASCII to the terminal?

Please look at tests/test-encoding.t. Not only does it show how you can
use arbitrary encodings in tests, it also gives a good idea of what the
behavior looks like when you switch encodings.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list