No me lee las 'Ñ' de un fichero!!!

22/06/2004 - 14:42 por Miguel Tubia | Informe spam
Hola,
en un fichero tengo unas cuantas 'Ñ' y con el código:

FileStream fs = null;
try
{
fs = new FileStream(@"c:\pp", FileMode.Open);

StreamReader sr=new StreamReader(fs);

this.txt_Datos.Text=sr.ReadToEnd();
}
catch(Exception exc)
{
this.txt_Datos.Text="ERROR AL LEER";
this.txt_Datos.AppendText(""+exc.Message);
}
finally
{
if (fs != null)
{
fs.Flush();
fs.Close();
}
}

no me lee ninguna eñe.
¿Pq es esto? ¿Alguien me puede echar una mano?
Muchas gracias
Un saludo
 

Leer las respuestas

#1 Miguel Tubia
22/06/2004 - 14:49 | Informe spam
Hola,
me respondo, por lo visto era cosa de la codificacion, cambiando

StreamReader sr=new StreamReader(fs,System.Text.Encoding.UTF7);



me lo lee. Pero, ¿alguien sabe si esto me puede causar mas problemas?

Muchas gracias

Un saludo

Preguntas similares