1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
Issue #2317 new

UnicodeDecodeError when saving settings / plugin for Bugtraq

Fernando Nájera
created an issue


I'm developing a plugin for a bugtraq engine, and I have this error in my x64 machine. The same code compiled for x86 and running in x86 works just fine. What I am doing when the error is triggered is to generate a parameter string that THg should save under [tortoisehg] issue.bugtraqparameters . The error occurs when I try to exit the THg Settings window (by saving).

I am absolute certain that the string I am generating has ASCII-only characters, so I don't know why it complains about 0xe1. Also, changing any other setting works, so the settings file itself seems to be OK. In particular, the string I am trying to save is this:


This is the error log:

** Mercurial version (2.3.2).  TortoiseHg version (2.5.1)
** Command: 
** CWD: C:\Windows\system32
** Encoding: cp1252
** Extensions loaded: mercurial_keyring, fetch, transplant, rebase, mq, relink, gpg, extdiff
** Python version: 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
** Processor architecture: x64
** Qt-4.8.0 PyQt-4.9.1
Traceback (most recent call last):
  File "tortoisehg\hgqt\settings.pyo", line 1136, in accept
  File "tortoisehg\hgqt\settings.pyo", line 1114, in applyChanges
  File "tortoisehg\hgqt\settings.pyo", line 1490, in applyChanges
  File "tortoisehg\util\wconfig.pyo", line 249, in writefile
  File "tortoisehg\util\wconfig.pyo", line 178, in write
  File "iniparse\ini.pyo", line 520, in __str__
  File "iniparse\ini.pyo", line 282, in __str__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 44: ordinal not in range(128)


Comments (2)

  1. Fernando Nájera reporter

    Oh, it turns out that there was some encoding issue in the existing file!.

    However, even with that bad encoding problem, if I change some other setting in TortoiseHG (for example, authorcolor) through the dialog, the file is saved without error (although the bad encoding is still there). For some reason, if the change is in the Bugtraq parameters string, then the bad encoding becomes a problem.

  2. Log in to comment