在终端问题中设置区域设置和语言



我将zsh用于iterm2(macOS 14 Mojave(的终端。我在设置区域设置和语言时遇到了许多问题。最近的问题是我不能在我的离子应用中使用椰子足类,因为宝石不能像根一样。这个问题之所以出现,是因为我的终端需要 UTF-8 编码,它确实如此。我遇到了这个问题,以至于我export LANG=en_US.UTF-8放在.zshrc文件、.profile文件和.bashrc文件中。我已经对上述所有文件运行了命令$ source ~/.zshrc。我已经完全关闭了终端,并重新启动了我的计算机。无论发生什么,无论何时我查看文件内部,所有信息都在那里。每当我尝试打开neo vim时都会发生同样的问题,我得到输出:

Warning: Failed to set locale category LC_NUMERIC to en_ES.UTF-8.
Warning: Failed to set locale category LC_TIME to en_ES.UTF-8.
Warning: Failed to set locale category LC_COLLATE to en_ES.UTF-8.
Warning: Failed to set locale category LC_MONETARY to en_ES.UTF-8.
Warning: Failed to set locale category LC_MESSAGES to en_ES.UTF-8.

这是我的.zshrc


export ZSH="/Users/me/.oh-my-zsh"
export LC_ALL=en_ES.UTF-8
export LC_NUMERIC=en_ES.UTF-8.
export LC_TIME=en_ES.UTF-8.
export LC_COLLATE=en_ES.UTF-8.
export LC_MONETARY=en_ES.UTF-8
export LC_MESSAGES=en_ES.UTF-8.
export LANG=en_US.UTF-8
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rbenv vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history time)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=’red’
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%f"
local user_symbol="$"
if [[ $(print -P "%#") =~ "#" ]]; then
user_symbol = "#"
fi
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%{%B%F{black}%K{yellow}%} $user_symbol%{%b%f%k%F{yellow}%} %{%f%}"
plugins=(
git
zsh-autosuggestions
)
source $ZSH/oh-my-zsh.sh
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
echo -e "33]6;1;bg;red;brightness;18a"
echo -e "33]6;1;bg;green;brightness;26a"
echo -e "33]6;1;bg;blue;brightness;33a"

那么这就是我在运行:checkhealth时从nvim得到的

========================================================================
## Configuration
- OK: no issues found
## Performance
- OK: Build type: Release
## Remote Plugins
- OK: Up to date
## terminal
- INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
- INFO: key_dc (kdch1) terminfo entry: key_dc=E[3~
- INFO: $TERM_PROGRAM='vscode'
- INFO: $COLORTERM='truecolor'
health#provider#check
========================================================================

无论我做什么,我都无法设置 lang 或 utf 或与此相关的任何内容

在我的.zshrc文件上,我添加了以下内容

export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

答案基于:https://github.com/vim/vim/issues/4556#issuecomment-503030484

请注意,在我找到答案时,我不允许发布答案,因为没有足够的时间过去。

至于为什么会这样。我不知道,我对这种类型的 Linux/shell 权限、编码等不太熟悉。

尝试在.zshrc中导出以下内容

export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8

答案基于:https://github.com/vim/vim/issues/4556#issuecomment-503030484

最新更新