Saving a file to CSV in C#/ASP.NET with different encodings
I do the following in my app:
File.WriteAllText(OutPutFileName + InPutTitle + ".csv", OutputText, Encoding.UTF8);
//outputText is a string of data separated by commas with line breaks
When I output with Encoding UTF8 and open the csv in Excel, each data point between commas is in each correct cell. But when I switch to Unicode or开发者_C百科 UTF32, the commas show up in excel and the data is on one long line.
How do I fix this while having encoding at UTF32 (I want this because I have certain chars that need displaying that don't come out in UTF8).
You might have to split that up into several lines. Use encoding UTF8 for the commas and other basic stuff, and only use UTF32 for what is needed.
精彩评论