日本字全角字符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
總結
以上是生活随笔為你收集整理的日本字全角字符linux,Linux命令行输入全角字符被转化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: empinfo Oracle数据库,Or
- 下一篇: cad大理石填充图案_CAD制图初学入门