Connecting Tech Pros Worldwide Help | Site Map

Reading the File contents along with Wild characters

  #1  
Old July 2nd, 2009, 03:43 PM
Newbie
 
Join Date: Feb 2008
Posts: 31
Hi,

I am trying to read the file contents using
Expand|Select|Wrap|Line Numbers
  1. System.IO.File.ReadAllText
After reading the file contents the special charaters (á) gets replaced with some garbage characters like "?".
To elliminate this I have used encoding along with above method
Expand|Select|Wrap|Line Numbers
  1. System.IO.File.ReadAllText(strFile, System.Text.Encoding.ASCII)
But still it is not working.Can anybody have the solution for this



Regards
Amol Lokhande
  #2  
Old July 3rd, 2009, 08:21 AM
sagark's Avatar
Newbie
 
Join Date: Jan 2009
Location: Pune, India
Posts: 11

re: Reading the File contents along with Wild characters


Hi Amol,

We need to read the file as per encoding type of the source file. If encoding type is unknown then we can use 'System.Text.Encoding.Default'

for example.

System.IO.File.ReadAllText(FilePath, System.Text.Encoding.Default)



Regards,
Sagar
  #3  
Old July 3rd, 2009, 08:24 AM
Newbie
 
Join Date: Feb 2008
Posts: 31

re: Reading the File contents along with Wild characters


Thanks Sagar. This really helped
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why C Is Not My Favourite Programming Language evolnet.regular@gmail.com answers 134 November 14th, 2005 07:25 PM