[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how to write special characters to an excel file in C#.Net

Posted on 2009-05-04
1
Medium Priority
?
640 Views
Last Modified: 2012-05-06
I have a text which contains special Characters: "création des motifs"
I need to write this to an excel file. This is not being written correctly.
Can anyone please help...
StreamWriter objFSOFile = null;
string strData = null;
string strPath = null;
objFSOFile = CreateStatFile("PROD.CSV", ref strPath);
strTitle = "création des motifs";
PrintFile(ref objFSOFile, strTitle);
 
public static StreamWriter CreateStatFile(string strFile, ref string strPath)
{
       System.IO.StreamWriter createStatFileReturn = null;
       FileInfo objFSO = null;
        if (!(Directory.Exists(@"C\PROD_CI\")))
            {
                Directory.CreateDirectory(@"C\PROD_CI\");
            }
            strPath = @"C\PROD_CI\" + strFile;
            objFSO = new FileInfo(strPath);
            if (objFSO.Exists)
            {
                objFSO.Delete();
            }
             createStatFileReturn = objFSO.CreateText();
             objFSO = null;
              return createStatFileReturn;
}
 
public static void PrintFile(ref StreamWriter objFSOFile, string strData)
{
       objFSOFile.WriteLine(strData);
}

Open in new window

0
Comment
Question by:MPakeezah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
MPakeezah earned 0 total points
ID: 24295687
The solution is while creating the file itself, create it as encoding UTF8.
createStatFileReturn = new StreamWriter(objFSO.Create(), System.Text.Encoding.UTF8);
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question