Byte Order Mark (BOM)
這幾天再寫讀檔
就遇到一個問題
在開檔的時候, 需要告知開檔的檔案編碼格式
但是如果使用者不知道
那就要用程式來判斷
問題就來了...
怎樣判斷???
這時候就要用到BOM
PS:但是不是所有的UTF8都有被加上BOM... 殘念阿...
Q: What is a BOM?
A: A byte order mark (BOM) consists of the character code U+FEFF at the beginning of a data stream, where it can be used as a signature defining the byte order and encoding form, primarily of unmarked plaintext files. Under some higher level protocols, use of a BOM may be mandatory (or prohibited) in the Unicode data stream defined in that protocol.
就遇到一個問題
在開檔的時候, 需要告知開檔的檔案編碼格式
但是如果使用者不知道
那就要用程式來判斷
問題就來了...
怎樣判斷???
這時候就要用到BOM
PS:但是不是所有的UTF8都有被加上BOM... 殘念阿...
Q: What is a BOM?
A: A byte order mark (BOM) consists of the character code U+FEFF at the beginning of a data stream, where it can be used as a signature defining the byte order and encoding form, primarily of unmarked plaintext files. Under some higher level protocols, use of a BOM may be mandatory (or prohibited) in the Unicode data stream defined in that protocol.
0 Comments:
張貼留言
<< Home