mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix locale initialization in terminal (IDEA-171957)
This commit is contained in:
@@ -315,17 +315,22 @@ public class EnvironmentUtil {
|
||||
|
||||
private static Map<String, String> setCharsetVar(@NotNull Map<String, String> env) {
|
||||
if (!isCharsetVarDefined(env)) {
|
||||
Locale locale = Locale.getDefault();
|
||||
Charset charset = CharsetToolkit.getDefaultSystemCharset();
|
||||
String language = locale.getLanguage();
|
||||
String country = locale.getCountry();
|
||||
String value = (language.isEmpty() || country.isEmpty() ? "en_US" : language + '_' + country) + '.' + charset.name();
|
||||
env.put(LC_CTYPE, value);
|
||||
String value = setLocaleEnv(env, CharsetToolkit.getDefaultSystemCharset());
|
||||
LOG.info("LC_CTYPE=" + value);
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String setLocaleEnv(@NotNull Map<String, String> env, @NotNull Charset charset) {
|
||||
Locale locale = Locale.getDefault();
|
||||
String language = locale.getLanguage();
|
||||
String country = locale.getCountry();
|
||||
String value = (language.isEmpty() || country.isEmpty() ? "en_US" : language + '_' + country) + '.' + charset.name();
|
||||
env.put(LC_CTYPE, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
private static boolean isCharsetVarDefined(@NotNull Map<String, String> env) {
|
||||
return !env.isEmpty() && (env.containsKey(LANG) || env.containsKey(LC_ALL) || env.containsKey(LC_CTYPE));
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.jetbrains.plugins.terminal;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.execution.TaskExecutor;
|
||||
import com.intellij.execution.configurations.EncodingEnvironmentUtil;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
@@ -124,7 +123,9 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
|
||||
envs.put("TERM", "xterm-256color");
|
||||
}
|
||||
|
||||
EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(envs, myDefaultCharset);
|
||||
if (SystemInfo.isMac) {
|
||||
EnvironmentUtil.setLocaleEnv(envs, myDefaultCharset);
|
||||
}
|
||||
|
||||
String[] command = getCommand(envs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user