相关疑难解决方法(0)

Bash 将国际字符显示为转义序列

当我在 bash 命令行中按下某些键(例如德语变音符号)时,我会得到转义序列。例如,ß给我\303. 这些转义序列被视为单个字符,因此一个退格键会删除整个序列。该字符只是在命令行上显示错误,但它被正确解释,例如键入echo ß给出:

$ echo \303
ß
Run Code Online (Sandbox Code Playgroud)

我猜它有非 7 位 ASCII 字符的问题。然而,在其他所有地方,这些都可以正常工作。我可以在 vim 中使用它们或用 cat 显示它们,而且 unicode 字符也可以正常工作。

如何让 bash 正确显示这些字符?


作为记录,

TERM=xterm-256color
LANG=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)

从我的.inputrc:

set input-meta on      # Enable Meta input with eighth bit set
set meta-flag on       # Synonym for the above
set convert-meta off   # Do NOT strip the eighth bit
set output-meta on     # Enable Meta output with eighth bit set
Run Code Online (Sandbox Code Playgroud)

输出 stty -a

speed 38400 baud; rows …
Run Code Online (Sandbox Code Playgroud)

bash readline inputrc

7
推荐指数
2
解决办法
1539
查看次数

标签 统计

bash ×1

inputrc ×1

readline ×1