encodingutf-8cocoapodsneovim

setting locale and language in terminal problem


I use zsh for my terminal with iterm2 (macOS 14 Mojave). I get numerous numerous numerous issues with setting the locale and language. the most recent issue being that I can't use cocopods for my ionic application because gems can't be as root. This issue comes down because my terminal needs to have UTF-8 encoding, which it does. I have had this issue so so so much that I have put export LANG=en_US.UTF-8 in the .zshrc file, the .profile file and .bashrc file. I have ran the command $ source ~/.zshrc on ALL of the files mentioned above. I have closed terminal completely, and restarted my computer. No matter what happens and whenever I look inside the file ALL that information is there. the same issue happens whenever I try to open up neo vim I get the output:

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.

here is my .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 "\033]6;1;bg;red;brightness;18\a"
echo -e "\033]6;1;bg;green;brightness;26\a"
echo -e "\033]6;1;bg;blue;brightness;33\a"


then this is what I get from nvim when running the :checkhealth

========================================================================
## 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
========================================================================

no matter what I do I cannot set the lang or utf or ANYTHING that has to do with that


Solution

  • On my .zshrc file, I added the following

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

    The answer is based on this GitHub post.

    As for why this works. I have no idea, I am not too familiar with this type of Linux/shell permissions, encoding, etc.