ZSH autocomplete issues in containers

When I use ZSH with a custom theme or with starship in a container, sometimes completion is broken: I type some characters (let’s say ts) then TAB for autocompletion and I’ll get the characters I typed and then the completion (in my example, tstsc for tsc). This doesn’t happen if I use Bash. This is very annoying, and I didn’t find a solution until this week.

With raw ZSH, changing the theme may help. For instance using the standard robbyrussell by doing:

export ZSH_THEME="robbyrussell"
source ~/.oh-my-zsh/oh-my-zsh.sh

But that can’t help with starship.

It appears the solution is simply to set LANG. I used export LANG=en_US.UTF-8 and it worked.

Note: setting TERM to xterm-256color when launching the container is a good idea too!