Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading the File contents along with Wild characters

Newbie
 
Join Date: Feb 2008
Posts: 31
#1: Jul 2 '09
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

sagark's Avatar
Newbie
 
Join Date: Jan 2009
Location: Pune, India
Posts: 11
#2: Jul 3 '09

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
Newbie
 
Join Date: Feb 2008
Posts: 31
#3: Jul 3 '09

re: Reading the File contents along with Wild characters


Thanks Sagar. This really helped
Reply


Similar Visual Basic .NET bytes