How to convert this unicode string to a normal string?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,all
I got a problem when I read a unicode file.
This file comes from my PDA. Log.txt. When I open it with notepad and click "save as", in the "save as" dialog, it shows the encoding is unicode.
In my c# project, I use
StreadReader reader = File.OpenText(strFileName);
while(szLine = reader.ReadLine() != null)
{
//Here, the szLine="0\06\0/\02\01\0/\02\00\00\04\0,\0...."
//In fact, the content is "06/21/2004, 10:36:59 The work is done."
How to convert szLine to the upper format?
}

Thanks
 
Replace
StreadReader reader = File.OpenText(strFileName);

with

StreadReader reader = new StreamReader(strFileName, Encoding.Unicode);



Mattias
 
It is really great. Before that, I tried to convert myself, but failed.

Thank you!.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top