TextReader tr = new StreamReader(@"palabrasn.txt");
TextWriter tw = new StreamWriter(@"resultados.xml");
ArrayList[] palabras=new ArrayList[15];
palabras[c] = new ArrayList();
while ((clinea = tr.ReadLine()) != null){
palabras.add(clinea);
}
[.net] Reading a spanish .txt file in C#
Im using C# scripts for a spanish word game dictionary using Visual Studio C# 2005 (the free edition from microsoft)
However the streamReader object wont recognize the spanish symbols like accents and such ( á é ñ) they are simply ignored and wont appear in the , Im using UTF8 to read but I cant get it to recognize those.
Any advice on how to do this?
Heres the part of the code with the problem
Try changing the current culture to spanish :
System.Threading.Thread.CurrentCulture = new System.Globalization.CultureInfo("sp");
Thanks, I tried to do this It sounds pretty logical, and I didnt knew you could do this, but it didnt work.
Btw, I used this one in the main function as this
Maybe this has to do with the StreamReader encodertype? how can I change that one? im using UTF8 which suposedly should work with spanish encoding.
Btw, I used this one in the main function as this
Thread.CurrentThread.CurrentCulture = new system.Globalization.CultureInfo("es-MX");
Maybe this has to do with the StreamReader encodertype? how can I change that one? im using UTF8 which suposedly should work with spanish encoding.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement