Search code examples
pythonpython-3.xpython-2.7mercurial

Mercurial Review board UnicodeEncodeError: 'charmap' codec can't encode character u'\ufffd' in position 31: character maps to <undefined>


I seem to have opened one of the .py files in mercurial(using Notepad++) , just out of curiosity to check how the mercurial hg extensions work, I am unable to use review board now : this is the error I am facing..I even replaced the reviewboard folder, but it seems the compiled python files are creating an issue. If there is some way to recompile these to reset the encoding, I'll be glad:

chcp 65001
set PYTHONIOENCODING=utf-8

I also tried setting back the encoding on my windows command line as suggested in some of the posts to fix the encoding issue :

#!python
** Mercurial version (4.6.1).  TortoiseHg version (4.6.1)
** Command: --nofork workbench
** CWD: C:\hiteshi\Latest\GM_dev
** Encoding: cp1252
** Extensions loaded: fetch, gestalt, kilnauth, big-push, kiln, caseguard, hgflow, strip, mq, reviewboard, histedit, shelve, largefiles, tortoisehg.util.configitems
** Python version: 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=2, build=9200, platform=2, service_pack='')
** Processor architecture: x64
** Qt-5.9.2 PyQt-5.9.1 QScintilla-2.10.2.dev1711012104
Traceback (most recent call last):
  File "tortoisehg\hgqt\postreview.pyo", line 361, in accept
  File "tortoisehg\hgqt\postreview.pyo", line 274, in postReviewOpts
  File "tortoisehg\hgqt\postreview.pyo", line 263, in getSummary
  File "tortoisehg\util\hglib.pyo", line 117, in fromunicode
  File "encodings\cp1252.pyo", line 12, in encode
UnicodeEncodeError: 'charmap' codec can't encode character u'\ufffd' in position 31: character maps to <undefined>

Solution

  • We got the issue, the Tortoise Hg updated version(4.6) in not compatible with the REview board version, seems that this issue is already raised on Tortoise Hg forum.. Solution 1) Revert Hg to a prior version 4.5. something or 2) Update the review board manually using the Export to Patch option