Why Empty Text File Contains 3 bytes?

后端 未结 1 468
借酒劲吻你
借酒劲吻你 2020-12-20 15:15

I\'m using a text file inside my C# project in vs2010. I added to solution and set its \"Copy Output\" to \"Copy Always\". When I use the following codes, it gives me the te

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-20 15:52

    So, those three bytes you are seeing are the byte order marker for the unicode file I am guessing. For UTF-8, it is three bytes.

    You can avoid those by saving the file using UTF-8 without signature.

    0 讨论(0)
提交回复
热议问题