"Copy patch" misencodes file contents
TortoiseHg offers to create a patch in the clipboard. For example, one could right-click a commit, do Export -> Copy patch, then open Notepad++ and paste.
Unfortunately, as of 6.4.2, the contents of file diffs in these patches is not properly encoded. In our case, even with UTF-8 files, non-ASCII characters in the clipboard are corrupted:
diff -r b37508d2d7a0 pes-sista/pes-sista-commun-webapp/pom.xml
--- a/pes-sista/pes-sista-commun-webapp/pom.xml Fri May 19 09:44:42 2023 -0400
+++ b/pes-sista/pes-sista-commun-webapp/pom.xml Fri May 19 11:47:35 2023 -0400
@@ -24,8 +24,8 @@
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
</dependency>
<!-- Autres Dépendances -->
In the above, "Autres Dépendances" should read "Autres Dépendances" (with an acute accent on the "e").
This happens on Microsoft Windows 10, even after setting the server encoding to UTF-8 in repository settings. The encoding of file names and patch descriptions (log messages) is fine.
This can be worked around with the command-line Mercurial client (hg diff
).