Yuya Nishihara committed 6cde376

filedata: decode file content in web.encoding by default

It can be changed by the context menu of the fileview later.

Comments (0)

Files changed (2)


 from hgext import record
 from tortoisehg.util import hglib, patchctx
+from tortoisehg.hgqt import fileencoding
 from tortoisehg.hgqt.i18n import _
 forcedisplaymsg = _('Display the file anyway')
         self.elabel = u''
         self.changes = None
+        self._textencoding = fileencoding.contentencoding(ctx._repo.ui)
     def createRebased(self, pctx):
         # new status is not known
         return self.__class__(self._ctx, pctx, self._wfile)
     def subrepoType(self):
+    def textEncoding(self):
+        return self._textencoding
+    def setTextEncoding(self, name):
+        self._textencoding = fileencoding.canonname(name)
     def _textToUnicode(self, s):
-        return hglib.tounicode(s)
+        return s.decode(self._textencoding, 'replace')
     def diffText(self):
         return self._textToUnicode(self.diff or '')


           '(separated by whitespace or ",") is also denied. The contents '
           'of the deny_push list are examined before the allow_push list.')),
     _fi(_('Encoding'), 'web.encoding', (genEditCombo, ['UTF-8']),
-        _('Character encoding name')),
+        _('Character encoding of files in the repository, used by the web '
+          'interface and TortoiseHg.')),
 ({'name': 'proxy', 'label': _('Proxy'), 'icon': QStyle.SP_DriveNetIcon}, (