[Bug 6821] New: hg init fails when HGENCODING is set to utf-8 and the repository name contains non-ASCII characters

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Fri Jun 16 07:04:28 UTC 2023


https://bz.mercurial-scm.org/show_bug.cgi?id=6821

            Bug ID: 6821
           Summary: hg init fails when HGENCODING is set to utf-8 and the
                    repository name contains non-ASCII characters
           Product: Mercurial
           Version: 6.4.2
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: rainer.bauer at telenot.de
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

Environment: Windows 10 21H2 19044.3086
hg version : Mercurial Distributed SCM (version 6.4.2)
             (I am using the latest version of TortoiseHg)

I was hit by this issue, when I called 'hg log' from my program.

However, when I tried to reproduce it in a command prompt, the error already
occured when I tried to create the repository.

Steps to reproduce:
1) Open command prompt (cmd.exe)
2) cd to a directory with write permission (e.g. %userprofile%)
3) 'hg init ää' (executed successful)
4) 'SET HGENCODING=utf-8'
5) 'hg init üü' (fails with error: 'abort: decoding near
'nd\hg_bug\��/.hg/00c': 'utf-8' codec can't decode byte 0xfc in position 34:
invalid start byte!')

I tried to set the codepage to unicode (CHCP 65001), but the error persists.

Here is the trace when 'hg init --traceback üü' is executed:

Traceback (most recent call last):
  File "mercurial\windows.pyc", line 184, in posixfile
FileNotFoundError: [WinError 2] The system cannot find the file specified:
'C:\\tmp\\hg_bug\\üü/.hg/00changelog.i'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mercurial\encoding.pyc", line 231, in fromlocal
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 34:
invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mercurial\scmutil.pyc", line 153, in callcatch
  File "mercurial\dispatch.pyc", line 441, in _runcatchfunc
  File "mercurial\dispatch.pyc", line 1266, in _dispatch
  File "mercurial\dispatch.pyc", line 899, in runcommand
  File "mercurial\dispatch.pyc", line 1278, in _runcommand
  File "mercurial\dispatch.pyc", line 1264, in <lambda>
  File "mercurial\util.pyc", line 1881, in check
  File "mercurial\commands.pyc", line 4444, in init
  File "mercurial\hg.pyc", line 270, in peer
  File "mercurial\hg.pyc", line 234, in repository
  File "mercurial\hg.pyc", line 147, in instance
  File "mercurial\localrepo.pyc", line 3598, in instance
  File "mercurial\localrepo.pyc", line 3967, in createrepository
  File "mercurial\vfs.pyc", line 124, in append
  File "mercurial\vfs.pyc", line 517, in __call__
  File "mercurial\windows.pyc", line 202, in posixfile
  File "mercurial\encoding.pyc", line 253, in unifromlocal
  File "mercurial\encoding.pyc", line 235, in fromlocal
mercurial.error.Abort: decoding near 'nd\hg_bug\üü/.hg/00c': 'utf-8' codec
can't decode byte 0xfc in position 34: invalid start byte!
abort: decoding near 'nd\hg_bug\��/.hg/00c': 'utf-8' codec can't decode byte
0xfc in position 34: invalid start byte!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list