我如何获得重音字母实际上在bash上工作? [英] How do I get accented letters to actually work on bash?
问题描述
cygwin上的我的bash安装不能正确处理重音字母。我尝试添加
在#上设置input-meta以接受8位字符
set output-meta#显示8位字符
set convert-meta#显示为字符,而不是八进制表示
到我的输入rc,但这还不工作。确实,如果我输入
$ echoù
然后在我按Enter键之前会自动更改为
$ echo \303
虽然输出正确,但我得到
$ echo \303
ù
我得到相同的结果任何其他重音信。通常,虽然我使用非意大利语键盘,我使用 autohotkey
替换带有重音字母的撇号后的字母。在这种情况下,重音字母被替换为 \302
,并根据字母打印垃圾:prints a 3y
为ù
,¢
如何让所有这些都有意义?
:我的区域设置,cygwin版本和终端如下
$ uname -a
pre>
CYGWIN_NT-6.1-WOW64 ferdi - Asus 1.7.17(0.262 / 5/3)2012-10-19 14:39 i686 Cygwin
$ locale
LANG = it_IT.UTF-8
LC_CTYPE =it_IT.UTF- 8
LC_NUMERIC =en_US.UTF-8
LC_TIME =it_IT.UTF-8
LC_COLLATE =it_IT.UTF-8
LC_MONETARY =it_IT。 UTF-8
LC_MESSAGES =it_IT.UTF-8
LC_ALL =
$ tty
/ dev / pty1
我调用它只需点击Cygwin终端链接。它重定向到
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
autohotkey脚本的相关部分如下
#NoEnv;推荐用于未来AutoHotkey版本的性能和兼容性。
SendMode输入;推荐用于新的脚本,由于其优越的速度和可靠性。
SetWorkingDir%A_ScriptDir%;确保一致的起始目录。
...
:: avra'::avrà
:: avro'::avrò
...
解决方案要在bash上通过
Cygwin
使用Mintty 1.1.2
只需执行以下操作:
- 转到 strong>(如果您没有看到任何菜单,请右键点击您的终端)。
- 点击选项... 。
- 点击文字。
- 将区域设置更改为
C
- 将字符集更改为
ISO-8859-1(西欧)
。
然后测试:
>
My bash installation on cygwin doesn't handle accented letters properly. I tried adding
set input-meta on # to accept 8-bit characters set output-meta on # to show 8-bit characters set convert-meta on # to show it as character, not the octal representation
to my input rc, but this doesn't quite work yet. Indeed, if I type
$ echo ù
then before i press enter it is automatically changed to
$ echo \303
although the output is right, for I get
$ echo \303 ù
I get the same result for anyother accented letter. Usually though I use a non-italian keyboard, and I use
autohotkey
to substitute letters with an apostrophe after them with an accented letter. When this is the case, accented letters get substituted with a\302
, and they print garbage depending on the letter: prints a3y
for aù
, a¢
for anò
, and nothing for everething else.How do I get all this to make sense?
EDIT: my locale settings, cygwin version and terminal are the following
$ uname -a CYGWIN_NT-6.1-WOW64 ferdi-Asus 1.7.17(0.262/5/3) 2012-10-19 14:39 i686 Cygwin $ locale LANG=it_IT.UTF-8 LC_CTYPE="it_IT.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="it_IT.UTF-8" LC_COLLATE="it_IT.UTF-8" LC_MONETARY="it_IT.UTF-8" LC_MESSAGES="it_IT.UTF-8" LC_ALL= $ tty /dev/pty1
I'm invoking it simply clicking the Cygwin terminal link. It redirects to
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -
The relevant part of the autohotkey script is the following
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ... ::avra'::avrà ::avro'::avrò ...
解决方案To get accented letters on bash via
Cygwin
usingMintty 1.1.2
just do the following:
- Go to the menu (if you don't see any menu, right click on your Terminal).
- Click Options....
- Click Text.
- Change the Locale to
C
.- Change the Character set to
ISO-8859-1 (Western European)
.Then test it:
这篇关于我如何获得重音字母实际上在bash上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!