2 月 272016
 

Source: UTF-8編碼中BOM的檢測與刪除

所謂BOM,全稱是Byte Order Mark,它是一個Unicode字符,通常出現在文本的開頭,用來標識字節序(Big/Little Endian),除此以外還可以標識編碼(UTF-8/16/32 ),如果出現在文本中間,則解釋為zero width no-break space注:Unicode相關知識的詳細介紹請參考UTF-8, UTF-16, UTF-32 & BOM。 對於UTF-8/16/32而言,它們名字中的8/16/32指的是編碼單位是多少位的,也就是說,它們的編碼單位分別是8/16/32位,換算成字節就 是1/2/4字節,如果是多字節,就要牽扯到字節序,UTF-8以單字節為編碼單位,所以不存在字節序。UTF-8主要的優點是可以兼容ASCII,但如 果使用BOM的話,這個好處就蕩然無存了,除此以外,BOM的存在還可能引發一些問題,比如下面錯誤便都有可能是BOM導致的:

  • Shell: No such file or directory
  • PHP: Warning: Cannot modify header information – headers already sent

Continue reading »

5 月 102015
 

Source: Disable automatic comment insertion - Vim Tips Wiki

Auto-comment allows easy insertion of additional lines of comments. For example, in a C++ file, if you insert a blank line after a comment line beginning with //, Vim may automatically insert // at the start of the new line. This tip explains how auto commenting can be disabled.

3 月 122013
 

原文(source): 好站: 一步步勾選打造屬於自己的 Vimrc | Tsung's Blog

Vim 是一套非常簡易輕巧的編輯器(學習可參考此篇投影片: Vim Hacks), 可以隨著自己喜好客製化成任何形式.

不過, 太精簡的畫面總會讓人望之卻步, 所以, 一般都會提供個很簡易的 vimrc 來參考, 再來修修改改成自己的版本~

Continue reading »