contrib/chg/chg.c
changeset 44308 04a3ae7aba14
parent 37871 3c84493556db
child 44621 1e459ac4cb48
--- a/contrib/chg/chg.c	Mon Feb 03 09:00:05 2020 +0100
+++ b/contrib/chg/chg.c	Wed Jan 29 13:39:50 2020 -0800
@@ -226,6 +226,16 @@
 	}
 	argv[argsize - 1] = NULL;
 
+	const char *lc_ctype_env = getenv("LC_CTYPE");
+	if (lc_ctype_env == NULL) {
+		if (putenv("CHG_CLEAR_LC_CTYPE=") != 0)
+			abortmsgerrno("failed to putenv CHG_CLEAR_LC_CTYPE");
+	} else {
+		if (setenv("CHGORIG_LC_CTYPE", lc_ctype_env, 1) != 0) {
+			abortmsgerrno("failed to setenv CHGORIG_LC_CTYYPE");
+		}
+	}
+
 	if (putenv("CHGINTERNALMARK=") != 0)
 		abortmsgerrno("failed to putenv");
 	if (execvp(hgcmd, (char **)argv) < 0)