Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a directory listing with files like:

drwxr-xr-x   2 nobody nogroup       4096 2011-01-11 21:06 Капкан
drwxr-xr-x   3 nobody nogroup       4096 2011-11-17 08:40 СБПЧ

When I copy/paste or directly input such filenames into the prompt, I expect to be able to work with them just like Latin-1 letters.

Instead, I get results like:

# Pasting "Капкан"
$ :?апкан 

You see the first letter is replaced by ":?". Then, I am not able to traverse the characters to the left except by deleting them. Keyboard-based input produces the same results. tmux or screen yank/paste produces the same results.

I'm not sure how to diagnose this situation! This is a pretty old Debian distro ($ uname -a Linux weezy 2.6.37.6.RNx86_32.1.4 #1 Thu Jul 26 04:49:29 PDT 2012 i686 GNU/Linux), but still I'd think that there's a way to get UTF-8 filenames behaving as I'd expect.

I am using OS X's Terminal.app and TERM is set to xterm-color.

I do believe these filenames are encoded using UTF-8. I am using Bash 3.1.17, and here is my output from locale:

$ locale
LANG=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

Here's my output from $ locale -a:

C
de_DE.utf8
en_US.utf8
ja_JP.utf8
ko_KR.utf8
nl_NL.utf8
POSIX
zh_CN.utf8
zh_TW.utf8

I would consider installing ru_RU.UTF-8 from /etc/locale.gen but I'm having trouble with basic Latin characters too, like á.

share|improve this question
    
That's what you get if you copy the letters from the terminal and try to paste them back? What terminal is this? – Etan Reisner Aug 19 '13 at 16:58
    
This also happens with direct input, not just pasting. I am using OS X's Terminal.app, and I've got TERM set to xterm-color. – dimadima Aug 19 '13 at 17:00
    
If this was xterm itself I'd suggest checking the various input settings for utf-8/eight-bit-input but I don't know if Terminal.app has those (I'd sort of hope not). Can you paste these characters into other applications correctly when copied from the terminal? – Etan Reisner Aug 19 '13 at 17:09
    
Yep, pasting out works fine: that's how I got those characters into this post. The problem, anyway, is both with direct input and copy/paste, both OS copy/paste and tmux vi-mode yank/paste. Amusingly, when I mount that path locally via SSHFS, I'm able to use my local Bash as expected: Input+autocomplete, AND copy/paste. – dimadima Aug 19 '13 at 17:11
    
Do you have the Escape non-ASCII characters setting in Terminal.app enabled or disabled? If it is enabled does disabling it help? – Etan Reisner Aug 19 '13 at 17:16
up vote 1 down vote accepted

As per comments above twiddling the Terminal.app Escape non-ASCII characters setting appears to have solved the problem. Though I am left confused at to the direction in which the twiddling was necessary to make this work correctly.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .