ASP.NET(VB.NET)でダウンロード時に日本語ファイル名が文字化けする。
Windows (NT系)はカーネルはUnicodeをアプリケーションはShift_JISを使っている。
HTTPリスポンスヘッダーのファイル名指定で日本語を使うと文字化けする場合があるが、URLエンコーディングを使うと回避できる。
Dim strFile As String = "テスト.xls"
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" & HttpUtility.UrlEncode(strFile))
Response.TransmitFile("D:\" & strFile)
Response.End()