Search code examples
unicodetortoisehgnon-ascii-characters

TortoiseHg commit complains about non-ASCII characters in the message


The subject tells it all. In 2015, one of the modern VCS doesn't want to accept multilingual commit messages. Though my main development language is English, I need to be able to comment on non-English stuff happening in the software. (I wonder why a program would care to use anything but UTF-8 nowadays, but it's another story.) It says:

enter image description here

I've found several posts on the web, discussing similar issues, but somehow none of them covers exactly this, nor do I understand how to solve the problem. I have already tried setting the system variable

enter image description here,

but TortoiseHg doesn't seem to notice the difference. On the other hand, I am not sure if I set it correctly.


Solution

  • You set HGENCODING as a system variable in Windows. That generally requires a restart to inherit the new environment in all processes. You may get away with closing and restarting TortoiseHg from the Windows Desktop as Explorer should get a notification that the variable changed and update its own environment.

    I could reproduce the issue on my system, but once the variable is set correctly TortoiseHG committed just fine. Using HGENCODING=UTF-8 is a valid spelling for that encoding.