How to configure bash to print utf8 error message?

試著忘記壹切 提交于 2019-12-24 06:39:19

问题


Strange UTF-8 handling in bash.

$ á
bash: $'\303\241': command not found

when run tcsh, so

$ tcsh   #or exec tcsh
> á
á: Command not found.

What can be wrong? How to setup bash for utf8 correctly?

And before mark this question as duplicate, please, read the next too:

My .inputrc:

set meta-flag on
set input-meta on
set output-meta on
set convert-meta off

set show-all-if-ambiguous On

"\e[A": history-search-backward
"\e[B": history-search-forward

set -o vi

my ENV:

LOCALE=UTF-8;           export LOCALE
LESSCHARSET='utf-8';    export LESSCHARSET
LANG=en_US.UTF-8;       export LANG
LC_ALL=en_US.UTF-8;     export LC_ALL

IMO, i have done all what must be done for utf8 handling in bash.

bash version:

bash --version
GNU bash, version 4.2.28(0)-release (amd64-portbld-freebsd9.0)

Any idea?


回答1:


It's new in Bash 4.2. See this.

There is a change in bash-4.2 that prints characters in error messages using ANSI-C escapes if isprint() fails for any character in the string. It's intended to make things like \r in filenames visible. It came in from cygwin, but is generally useful.

Chet

Chet Ramey is the maintainer of Bash.



来源:https://stackoverflow.com/questions/10952505/how-to-configure-bash-to-print-utf8-error-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!