如果文件包含德语变音符号,我将面临导入CSV文件的问题。我曾尝试过代码。
public TablePreviewDto ProcessCsv(CsvFileDto csvFileDto)
{
byte[] data = Convert.FromBase64String(csvFileDto.EncodedString.Replace("data:application/vnd.ms-excel;base64,", ""));
string fileContent;
if (!String.IsNullOrEmpty(csvFileDto.EncodingName))
{
fileContent = Encoding.GetEncoding(csvFileDto.EncodingName).GetString(data);
}
else
{
StreamReader sr = new StreamReader(new MemoryStream(data), true);
fileContent = sr.ReadToEnd();
}
return ProcessCsvContent(csvFileDto, fileContent);
}
我哪里错了?