Error while downloading a spreadsheet with Korean name (asp.net/C#)http://forums.asp.net/t/1798341.aspx/1?Error+while+downloading+a+spreadsheet+with+Korean+name+asp+net+C+Sat, 05 May 2012 02:37:37 -040017983414957599http://forums.asp.net/p/1798341/4957599.aspx/1?Error+while+downloading+a+spreadsheet+with+Korean+name+asp+net+C+Error while downloading a spreadsheet with Korean name (asp.net/C#) <p>Hi,</p> <p>I have a module for attachments. I am able to attach &amp; download the file correctly when the file name is in english. However when the file name is in korean, for some cases (no specific patterns), I am not able to download the attached file. I will get the error message as 'unknown File Type'. When I debug, the file path &amp; name are correct but on the screen, I see the (.xls) is changed to (__xls) and hence the file format is not recognized.</p> <p>The attachment &amp; download code are prety simple. For attachement I use:</p> <p>string relativePath = sb.ToString();<br> if (!Directory.Exists(Server.MapPath(&quot;&quot;) &#43; relativePath))<br> {<br> Directory.CreateDirectory(Server.MapPath(&quot;&quot;) &#43; relativePath);<br> }<br> objAttachment.Storename = DateTime.Now.Ticks &#43; Regex.Replace(objAttachment.Filename, @&quot;\s&quot;, &quot;&quot;);</p> <p></p> <p>and for downloading, I use</p> <p>context.Response.Clear();<br> context.Response.ClearContent();<br> context.Response.ClearHeaders();<br> context.Response.ContentType = &quot;application/octet-stream&quot;;<br> context.Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=&quot; &#43; fileName);<br> string strcompletePath = context.Server.MapPath(&quot;&quot;).Substring(0,(context.Server.MapPath(&quot;&quot;).Length -9)) &#43; fileName;<br> context.Response.TransmitFile(strcompletePath);<br> context.Response.End();</p> <p>I just renamed my english excel file with korean name as - and I was able to resproduce the error.</p> <p></p> <p>Thanks in advance.</p> <p></p> 2012-04-30T07:00:55-04:004966452http://forums.asp.net/p/1798341/4966452.aspx/1?Re+Error+while+downloading+a+spreadsheet+with+Korean+name+asp+net+C+Re: Error while downloading a spreadsheet with Korean name (asp.net/C#) <p>What's case if you download other types of file?</p> <p>Try this: context.Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment;filename=&quot; &#43; &quot; .xls&quot;);</p> <p>Maybe you need to consider set&nbsp;the Culture and UI Culture:</p> <p><a href="http://msdn.microsoft.com/en-us/library/bz9tc508.aspx">http://msdn.microsoft.com/en-us/library/bz9tc508.aspx</a></p> 2012-05-05T02:37:37-04:00