5

I am not able to properly display autocompleted filenames that contain accented characters like ã in my shell configuration of zsh and oh-my-zsh.

I've created a filename cão.txt to demonstrate this issue. If you're interested, that means dog in Portuguese.

So, when I try to autocomplete like cat c<tab>, this happens:

% cat ca<0303>o.txt
hi dog

and echo $0 gives me: -zsh

But, if I go to a "plain" zsh session the exact same autocomplete works ok:

% zsh
% echo $0
zsh
%  cat cão.txt
hi dog

My locale is like this:

LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

and the LANG variable I tried it empty, with "en_US.UTF-8" and also "pt_PT.UTF-8". Also, I double-checked the locale settings are exactly the same before and after going to the "plain" zsh session.

Also it works the same way in both the default terminal OSX application and iTerm2.

I'm using zsh version 5.0.7.

Here is my .zshrc file, as well as other dotfiles I'm using.

I've tried uninstalling oh-my-zsh and install it in either the automatic and manual way, always with the same problem of displaying accented characters with autocomplete.

  • 2
    What zsh version do you have? I have 4.3.17 and cão.txt is autocompleted with ã character. I also have LANG set to en_US.UTF-8. – Arkadiusz Drabczyk Jan 12 '15 at 16:15
  • Just to clarify: In step 3. you start bash from within your running zsh session and in step 5. you exit the bash session back to the original zsh session? All in the same terminal? And any other sessions remain unaffected? Also do you have anything special in your bash configuration? For example calls to tput or anything else, that would affect the terminal emulator. Could you perhaps post a link to your configuration (bash and zsh) or post it in your question (if it is not to long?). – Adaephon Jan 12 '15 at 16:59
  • @ArkadiuszDrabczyk: Hm.. Really? Good news then. Should be something in my setup rather than in zsh itself. I've updated my answer accordingly to your question. I'm using zsh version 5.0.7 and bash 4.3.30. Thanks for your reply! Any other ideas? – nunos Jan 12 '15 at 21:22
  • @Adaephon: I do that all in the same terminal session yes. I've just tried it and other terminal sessions remain unaffected, that is, in another session, separate from the one that starts in zsh and goes to bash and back to zsh, in that other one the problem still remains. Also, I have no bash configuration files at all. And for my .zshrc please I've included a link in my updated to my dotfiles. Thanks for your reply. Any other ideas? – nunos Jan 12 '15 at 21:24
  • bash may read ~/.profile, /etc/bash.bashrc, /etc/profile or other files sourced from there. Does completion work correctly in a zsh session started with zsh -f? Does the behaviour change if you start and exit ksh or tcsh instead of bash? – Adaephon Jan 13 '15 at 12:27
1

This looks like normal default zsh behavior. Whether combining characters are displayed combined during autocompletion is controlled by the combining_chars shell option. To have it complete to cão, put this in your ~/.zshrc file.

setopt combining_chars

I can't reproduce your behavior where this is the default for non-login (zsh vs -zsh) shells.

In the case of zsh -f and the non-login zsh, they are sourcing only /etc/zshenv, and not the other configuration files. Maybe you have your /etc/zshenv configured to setopt combining_chars and something later in the initialization sequence is resetting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.