Código:
And then I set the ContentType and I add a header to download the content. This is the code:resultados.Controls.Add(new LiteralControl(sb.ToString()));
Código:
The data that I get from the database, which I display into the StringBuilder. Sometimes the whole document get disturbed with strange characteres, like if it wasn´t UTF-8 text.Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=Indicador.xls"); Response.ContentEncoding = Encoding.UTF8; Response.Charset = ""; Response.Write(sb.ToString());
It's very strange and it happened to me a lot of times and I want to know once and for all what is happening.
This is one example of the text that causes the whole mess.
"La tasa está calculada a mitad del período. La etiqueta 1987 representa el período 1987-1992. La etiqueta 1992 representa el período 1992-1997. La etiqueta 1997 representa el período 1997-2002. La etiqueta 2004 representa el período 2004-2009."
As you can see, it's spanish and it may be because the accents.
If I only take till the second sentences, it doesn't happend, and you can realize that "está" and "período" have accent. Therefore it's not because the accent.
Afterwards, I take till the third sentence and everything get into a mess... and I can't find what is happening. There must be some special characteres, that I cannot see? Also de fourth sentence make some noise on the document.
¿What is going on with the encoding process?
I will really appreciate if you could advise me some how.
Thank you in advance.
Raul Bolaños.