2012年11月5日 星期一

Linux vi 存檔錯誤

File-encodings setting (notice the plural) does not include utf-8, so Vim does not try to save it with that encoding. It probably either tries to save it using plain old ASCII encoding or something like latin1, which does not include this char and therefore conversion fails. 
You should fix your 'fencs' setting to something like ucs-bom,utf-8,default,latin1 or you can force Vim to save it in utf-8 encoding, by issuing :w ++enc=utf8 filename. (It might be, that this needs the +multi_byte feature, which is only enabled, when compiling at least a big version of Vim). 

簡單的說就是檔案含有UTF-8的內容,vim存檔時沒有使用UTF-8的encoding存檔所產生的錯誤。

解決方法只需在存檔時加入一個option即可,如下:

:w ++enc=utf8 FileName

沒有留言:

搜尋此網誌