Unreadable zsh shell and backspace do not work on zsh shell on Docker

I used FROM rails:onbuild image

  • You can see the wrong / unreadable encoding here

  • When I type backspace after test , it doesn't work, it adds spaces in the shell

Here are the environment variables,

any ideas for error?

 RUBY_MAJOR=2.2 RUBY_VERSION=2.2.2 RUBY_DOWNLOAD_SHA256=5ffc0f317e429e6b29d4a98ac521c3ce65481bfd22a8cf845fa02a7b113d9b44 GEM_HOME=/usr/local/bundle BUNDLE_APP_CONFIG=/usr/local/bundle LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 HOME=/root LOGNAME=root SHLVL=1 PWD=/associate-app OLDPWD=/associate-app ZSH=/root/.oh-my-zsh PAGER=less LESS=-R LSCOLORS=Gxfxcxdxbxegedabagacad _=/usr/bin/env 

DOCEKRFILE (here is my docker file)

 FROM rails:onbuild RUN apt-get update && apt-get -y upgrade RUN apt-get -y -qq --force-yes install \ build-essential \ tree \ locales \ ruby-dev \ vim \ vim-scripts \ git \ git-flow\ curl \ zsh \ sudo # Install Zsh RUN git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh \ && cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \ && chsh -s /bin/zsh RUN sed -i -E "s/^plugins=\((.*)\)$/plugins=(\1 git git-flow ruby tmux)/" ~/.zshrc # Make ssh dir RUN mkdir /root/.ssh/ # Copy over private key, and set permissions ADD id_rsa /root/.ssh/id_rsa # Create known_hosts RUN touch /root/.ssh/known_hosts # Add bitbuckets key RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts RUN echo "alias ls='ls --color=auto'" >> /etc/zsh/zshrc && \ echo "alias ll='ls -halF'" >> /etc/zsh/zshrc && \ echo "alias ls='ls --color=auto'" >> /etc/profile && \ echo "alias ll='ls -halF'" >> /etc/zsh/zshrc # copy GEMFILE WORKDIR /tmp COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock RUN bundle install RUN mkdir /associate-app WORKDIR /associate-app ADD . /associate-app RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 CMD echo 'LC_ALL=en_US.UTF-8' >> ~/.zshrc && \ echo 'LANG=C.UTF-8' >> ~/.zshrc && \ echo 'LC_CTYPE=en_US.UTF-8' >> ~/.zshrc && \ CMD ["zsh"] 

stty -a

 speed 38400 baud; rows 40; columns 164; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke 
+6
source share
1 answer

Your local settings are incompatible

 LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8 

That is, LANGUAGE does not use UTF-8, while other settings do this.

This may be part of the problem.

In addition, some terminals implement the iutf8 parameter for stty . This tells the terminal driver how to adjust the cursor position for multi-byte characters (UTF-8). You can check if stty -a -iutf8 (the function is disabled) and enable it if it is not, like

 stty -a stty iutf8 

When a function is available, the terminal driver knows that it must consider whether UTF-8 text is used (and may have several bytes per column). If this is not the case, it will consider each byte as a column, and when erasing the "last" character, it can do something like this:

 backspace space space 

creating the effect shown above.

Finally, it would be nice to know the terminal used. For example, rxvt does not support UTF-8; xterm can be configured with / without UTF-8. The value of TERM is largely irrelevant, as your shell probably ignores it in favor of inline behavior.

+2
source

Source: https://habr.com/ru/post/987487/


All Articles