日本字全角字符linux,Linux命令行输入全角字符被转化

产品经理在jira里报了个ticket,说文章里有链接404了。另外非常积极主动的说,应该是没填“http://“协议头。哎,好好提你的bug,把解决bug的事情留给专业人士来不行么。人与人之间的沟通有时候就是要逞一下能,显得”我“是这个世界的主宰,在座各位都是垃圾。。。

行行行,犊子扯远了,bug还得修不是。一看这哪里是什么缺协议头。就是编辑缺了点心眼,该输入半角符号的地方,填了个全角。

href=“http (错误)

href="http (正确)

就这么个事情。目测处理起来会异常简单,wp search-replace 'href=“http' 'href="http' --dry-run

就可以了。

本地Mac OS搞定不表,登录测试服务器Ubuntu,贴命令,特么那个全角双引号怎么不见了

convert-meta

If set to ‘on’, Readline will convert characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and prefixing an ESC character, converting them to a meta-prefixed key sequence. The default value is ‘on’, but will be set to ‘off’ if the locale is one that contains eight-bit characters.

大概意思是,如果这个convert meta设置开启下,带有第8个比特的字符会被转化成一个带了meta key的组合键。很显然全角字符是两个字节,所以就被转化掉了。

查看了下,我本地mac和测试机器Ubuntu,确实设置不一样。ubuntu下

$ bind -v | grep meta

set convert-meta on

Mac OS下

$ bind -v | grep meta

set convert-meta off

知道了问题根源,解决起来就简单多了。编辑测试机ubuntu下/etc/inputrc文件(或者新建~/.inputrc),嘿,写得清清楚楚:# To allow the use of 8bit-characters like the german umlauts, uncomment

# the line below. However this makes the meta key not work as a meta key,

# which is annoying to those which don't need to type in 8-bit characters.

# set convert-meta off

关闭convert-meta选项的代价是meta key就不工作了。我日常工作好像不是特别依赖这个meta key,关了就关了吧。

参考:

1. https://linux.101hacks.com/unix/bind/

2. https://unix.stackexchange.com/questions/98185/bash-environment-pasting-strings-with-special-characters

3. https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值