0

My code to create a CSV file that contains Danish characters

     Response.ClearContent();
     Response.AddHeader("content-disposition", attachment);
     Response.ContentType = "application/csv;charset=utf-8";
     Response.Charset = "utf-8";
     Response.Write(sb.ToString());
     Response.End();

Don't know why but when result CSV is created danish characters are replaced with some special characters like ??j.Can any one give me any clue?

4

1 回答 1

1

Is the source text in the StringBuilder UTF-8? If not there is a chance that .NET gets confused and writes the wrong characters. If it isn't in UTF-8 try running Encoding.Convert before writing to the client.

于 2013-03-18T11:34:25.257 回答