Solved

StreamReader reading unicode characters

Posted on 2007-03-30
3
3,019 Views
Last Modified: 2013-11-07
I use the following code to open a text file.
StreamReader sr = File.OpenText(sFilePathName);
sr.ReadLine();
 
However the following was there in the text file with the unicode character, but the unicode character was chopped out
Revised list Home Décor stores 6-10-05
This was read as
Revised list Home Dcor stores 6-10-05

Is there anyway I can read it the exact text with the unicode.


0
Comment
Question by:vasudharangapathy
3 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 18824254
Hi vasudharangapathy;

The Encoding is the issue. File.Open only reads the file in UTF-8 encoding. Use the following to do what you need.

      StreamReader sr = new StreamReader(sFilePathName,System.Text.Encoding.Default);
      string input = sr.ReadLine();
      MessageBox.Show( input );
      sr.Close();

Fernando
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now