Why are file names surrounded with "â" sign?
9,915
These â
s are UTF-8 quotes that your current terminal is unable to display properly, being configured in ISO-8859-1 or similar.
You can have a proper display with setting a matching locale or the POSIX one:
$ rm file.txt
rm: cannot remove â file.txtâ : No such file or directory
$ LC_ALL=en_US.UTF-8 rm file.txt
rm: cannot remove â file.txtâ : No such file or directory
$ LC_ALL=C rm file.txt
rm: cannot remove 'file.txt' : No such file or directory
$ rm foo 2>&1 | od -c
0000000 r m : c a n n o t r e m o v
0000020 e 342 200 230 f o o 342 200 231 : N o
0000040 s u c h f i l e o r d i r
0000060 e c t o r y \n
0000067
$ LC_ALL=C rm foo 2>&1 | od -c
0000000 r m : c a n n o t r e m o v
0000020 e ' f o o ' : N o s u c h
0000040 f i l e o r d i r e c t o
0000060 r y \n
0000063
Related videos on Youtube
Author by
Alan Kis
Updated on September 18, 2022Comments
-
Alan Kis over 1 year
After adding
alias rm='rm -i'
to my~/.bashrc
file (because, when I removed a file, it wasn't asking for confirmation), file names are surrounded with "â" signs as in the example below:rm: cannot remove âfile1.txtâ: No such file or directory
List of aliases:
alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l.='ls -d .* --color=auto' alias ll='ls -l --color=auto' alias ls='ls --color=auto' alias rm='rm -i' alias vi='vim' alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
Note: I am ssh'ing to my CentOS machine with PuTTY from my Windows machine, so this is definitely a character encoding issue. Using Ubuntu guest in my VM, everything is fine. Smart quotes are showing as they need to.
-
ott-- almost 9 yearsIs there another alias for
rm
already? Can you show all of them? Do you also have completion enabled? -
smw almost 9 yearsIs there actually a file called
file1.txt
? That looks like the normal response fromrm
for a non-existent file when there is a character set translation issue (a terminal set up for ISO-8859-1 rather than UTF-8 for example) -
Alan Kis almost 9 years@steeldriver, same for existing and non-existing file.
-
Alan Kis almost 9 years@ott-- see edit.
-
-
Admin almost 9 yearsHow did you get the first
rm
to generate UTF-8 quotes? I'm having trouble duplicating that. I can't tell if my locale is off, or if I've got xterm doing something right, which is wrong for getting an erroneous condition. -
jlliagre almost 9 yearsGNU
rm
generates UTF-8 opening and closing quotes when it is running under an UTF-8 locale (see my updated answer). This is by design. There is nothing specific to configure. -
Admin almost 9 yearsThanks. I'm not sure that all the steps I took to duplicate are necessary but... 1. Use PuTTY, setting "Translation" to ISO-8859-1. ssh to linux machine. 2. Unset environment variables LC_ALL, TERM, TERMINAL, XTERM_LOCAL. 3. set environment variable LAN=en_US.UTF-8. I finally got UTF-8 left- and right-single quotes, 4. Run
dash
shell. I got ASCII single-quote bytes for all the other combos of xterm, LC_ALL, LANG, TERM, TERMINAL, etc that I tried. I also got the a-circumflex-file1.txt-a-circumflex as the question has: no visible characters after the a-circumflex as in your example. -
jlliagre almost 9 years@BruceEdiger My tests were done using with a Solaris installation configured to use UTF-8 and in a Solaris text console, i.e. outside any graphic environment. The Solaris console doesn't support UTF-8.
-
Alan Kis almost 9 years@jlliagre, It is possible that this is character encoding problem. Most important, I forgo to mention that I am usually ssh with Putty from my Win machine.
-
jlliagre almost 9 yearss/possible/certain/ !