[IronPython] Spanish characters with accents do not see correctly

Paparipote . paparipote at hotmail.com
Tue Jan 24 21:22:33 CET 2006

I have the next text file named “ent” with the next 3 lines:
--> áéíóúñÑü¿?¡! <--

I execute the next script in IP

>>>e=open("c:/ent", "r")
>>>for i in e.readlines():
...     print i

--> ???????????! <--



I hope you see the problem produced. Some common letters in the spanish 
language the ones with accent were replaced by another characters. May be 
unicode is the cause.

To avoid this issue in C#, I use System.Text.Encoding.Default i.e.:
r=new StreamReader(@"C:\ent", System.Text.Encoding.Default);
w=new StreamWriter(@"C:\ent", False, System.Text.Encoding.Default);
Depending if I read and/or write data

How can I solve this in IP?
Best regards

Charla con tus amigos en línea mediante MSN Messenger: 

More information about the Ironpython-users mailing list