Let's default to a UTF-8 locale when running commands using nspawn.
NULL, /* LISTEN_PID */
NULL, /* NOTIFY_SOCKET */
NULL, /* CREDENTIALS_DIRECTORY */
+ NULL, /* LANG */
NULL
};
const char *exec_target;
n_env++;
}
+ if (arg_start_mode != START_BOOT) {
+ /* If we're running a command in the container, let's default to the C.UTF-8 locale as it's
+ * part of glibc these days and was backported to most distros a long time before it got
+ * added to upstream glibc. */
+ envp[n_env] = strdup("LANG=C.UTF-8");
+ if (!envp[n_env])
+ return log_oom();
+ n_env++;
+ }
+
env_use = strv_env_merge(envp, os_release_pairs, arg_setenv);
if (!env_use)
return log_oom();