Skip to content

'utf-8' codec can't decode byte... with accented username #208

@Tomalak

Description

@Tomalak

I'm working on Windows 10, Mercurial 6.9.1, vscode-hg 1.9.0.

The .hgrc file in my home directory is ANSI-encoded ("ANSI" meaning "the configured Windows default encoding", in my case that's Windows-1252).

My Mercuial username contains an accented character.

For some reason, vscode-hg seems to load the .hgrc file in the UTF-8 encoding, or possibly run all of Mercurial in an UTF-8 context, I'm not sure what's going on there.

As a result, committing from the left VSCode sidebar fails - it aborts and rolls back with a Python decoding error ("'utf-8' codec can't decode byte... invalid start byte!"), pointing to my username.

Committing manually with hg commit -m "..." works, both from the VSCode-integrated console and from outside of VSCode.

Changing my .hgrc to UTF-8 encoding fixes the issue with committing from the VSCode sidebar, but breaks all other methods (command line, TortoiseHg).

How to reproduce

  • change [ui]/username in your .hgrc so that it contains an accented character
  • save the file in a single-byte encoding, such as latin-1 or Windows-1252
  • (re)start VSCode
  • try to commit a change

Unfortunately, I can't easily change the default encoding of my machine without causing other issues, so for the time being I'm stuck with Windows-1252.

Is here a way for me to change how Mercurial is run by vscode-hg in order to work around this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions