--- a/tests/test-i18n.t Thu Oct 12 22:09:11 2017 +0900
+++ b/tests/test-i18n.t Fri Oct 13 21:36:10 2017 +0900
@@ -48,3 +48,23 @@
$ $PYTHON check-translation.py *.po
$ $PYTHON check-translation.py --doctest
$ cd $TESTTMP
+
+Check i18n cache isn't reused after encoding change:
+
+ $ cat > $TESTTMP/encodingchange.py << EOF
+ > from mercurial import encoding, registrar
+ > from mercurial.i18n import _
+ > cmdtable = {}
+ > command = registrar.command(cmdtable)
+ > @command(b'encodingchange', norepo=True)
+ > def encodingchange(ui):
+ > for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
+ > encoding.encoding = encode
+ > ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
+ > EOF
+
+ $ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
+ (?????)
+ (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
+ (?????)
+ (\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)