Special characters getting added while reading data from csv in C#

244 Views Asked by At

I am writing data in CSV and reading the line from CSV in C#. When I am writing data -

using StreamWriter streamWriter = new StreamWriter(outputFilePath);
using var csv = new CsvWriter(streamWriter, CultureInfo.InvariantCulture);

In CSV file data looks like this

70ea2d19-1776-4f25-b564-9eecf0a857df<->{"eeea3add-4e78-4a70-b674-1d

When I am reading data -

sing (StreamReader streamReader = new StreamReader(filePath))
            {
                string currentLine;
                while (!string.IsNullOrWhiteSpace(currentLine = streamReader.ReadLine()))
                {.
.
.
.

I get the line as

"\"70ea2d19-1776-4f25-b564-9eecf0a857df<->{\"\"eeea3add-4e78-4a70-b674-1d55ddd2165e\"\":[{\

How to get rid of these special characters? Regex.Unescape didnt work.

0

There are 0 best solutions below