简体   繁体   English

.csv文件读取困难

[英]Difficulty reading .csv file

I am trying to read in a .csv file (output from Excel) in C. I assumed the file would only be text values, but I have found 3 characters at the beginning of the file. 我试图读取C中的.csv文件(Excel的输出)。我认为该文件只是文本值,但是我在文件的开头发现了3个字符。 They are (unsigned char): 239, 187, 191. 它们是(无符号字符):239、187、191。

Since I am not expecting these values, my reader gets confused and causes problems. 由于我不期望这些值,所以我的读者会感到困惑并引起问题。 But I have not been able to find documentation. 但是我一直找不到文档。 I saved the file as a UTF-8 .csv file from Excel. 我从Excel将文件另存为UTF-8 .csv文件。

The UTF-8 representation of the BOM (byte order mark) is the (hexadecimal) byte sequence 0xEF,0xBB,0xBF. BOM的UTF-8表示形式(字节顺序标记)是(十六进制)字节序列0xEF,0xBB,0xBF。 These may be displayed as the characters . 这些可能显示为字符。

In decimal, these values are 239, 187, and 191 as shown above. 如上所示,以十进制表示的这些值为239、187和191。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM