I have a client who has asked us to write a c# application that takes data from their database and output it to a .csv file. So far so good.
This DB contains some unicode characters and when the client opens up the .csv with Excel those characters look “weird”. Ex: x0096 looks like an A with a carrot on top next to the Euro currency sign, when the client thinks it should look like a Dash.
So I have been asked to make those characters look “not wierd”.
I have written code for each weird character (I have like 12 of the below lines).
input = input.Replace((char)weirdCharacter, (char)normalCharacter);
There has got to be a better way.
I had the same problem when I was generating HTML files. The solution for me was to change the encoding of my output file.
Once I added the Encoding.UTF8 parameter the characters started displaying correctly. I don’t know if this can be applied to your solution though since Excel is involved, but I am betting it can be.