검정색 다이아몬드가있는 csv 파일의 문자에 문제가 있습니까? 중간에.유니 코드 문자를 읽으려는 csv 판독기 수정
나는 csv를 구문 분석하기위한 코드를 작성했지만, 왜 문자열이 유니 코드 문자를 제대로 읽지 못하는지 알지 못합니다. 아마도 내 구현과 관련이 있습니다.
StreamReader readFile = new StreamReader(path)
try {
while ((line = readFile.ReadLine()) != null) {
string[] row = { "", "", "" };
int currentItem = 0;
bool inQuotes = false;
if (skippedFirst && currentItem != 3) {
for (int i = 0; i < line.Length; i++) {
if (!inQuotes) {
if (line[i] == '\"')
inQuotes = true;
else {
if (line[i] == ',')
currentItem++;
else
row[currentItem] += line[i];
}
} else {
if (line[i] == '\"')
inQuotes = false;
else
row[currentItem] += line[i];
}
}
parsedFile.Add(row);
}
skippedFirst = true;
}
경우, 당신은 인코딩 부분 생성자를 사용할 수 있습니다 '. –
'readFile'의 생성을 보여줍니다. – leppie
@ Trustme-I 'mDoctor 답변으로 올려주세요! 저것은 훌륭하게 도와주었습니다. – ediblecode