?
Solved

StreamReader reading unicode characters

Posted on 2007-03-30
3
Medium Priority
?
3,158 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
[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
3 Comments
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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 …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 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