Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with downloading arabic named file..

Problem with downloading arabic named file..

Scheduled Pinned Locked Moved ASP.NET
helpquestion
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    khurram rathor
    wrote on last edited by
    #1

    Hello, I'm working on some application. One of the form is getting file bytes by calling WebService Method. My Code is Downloading the file perfectly, but the problem is with arabic named file, that its name shows Garbage Characters in SaveFile Dialogue Box before downloading. I'm doing like this.. Response.Clear() Response.ContentType = "APPLICATION/OCTET-STREAM" Response.AddHeader("Content-Disposition", "attachment; filename=" & ArabicFileName.Trim() & "." & FileType.Trim() & "; size = " & Bytes.Length.ToString()) Response.CharSet = "1256" Response.AddHeader("Content-Length", Bytes.Length) Response.BinaryWrite(Bytes) Response.Flush() After that, Explorer displays Save Dialogue. But it corrupts Arabic FileName. Can anyone tell me that what is the problem with arabic named files, though English named files are fine. My window also support Arabic. Thanks. khurram rathor

    M 1 Reply Last reply
    0
    • K khurram rathor

      Hello, I'm working on some application. One of the form is getting file bytes by calling WebService Method. My Code is Downloading the file perfectly, but the problem is with arabic named file, that its name shows Garbage Characters in SaveFile Dialogue Box before downloading. I'm doing like this.. Response.Clear() Response.ContentType = "APPLICATION/OCTET-STREAM" Response.AddHeader("Content-Disposition", "attachment; filename=" & ArabicFileName.Trim() & "." & FileType.Trim() & "; size = " & Bytes.Length.ToString()) Response.CharSet = "1256" Response.AddHeader("Content-Length", Bytes.Length) Response.BinaryWrite(Bytes) Response.Flush() After that, Explorer displays Save Dialogue. But it corrupts Arabic FileName. Can anyone tell me that what is the problem with arabic named files, though English named files are fine. My window also support Arabic. Thanks. khurram rathor

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      From what I know, the filename parameter value is limited to US-ASCII. You can find the range of valid values for "Content-Disposition" in the RFC 1086 [^]. Have a look at the Filename Parameter section.

      K 1 Reply Last reply
      0
      • M minhpc_bk

        From what I know, the filename parameter value is limited to US-ASCII. You can find the range of valid values for "Content-Disposition" in the RFC 1086 [^]. Have a look at the Filename Parameter section.

        K Offline
        K Offline
        khurram rathor
        wrote on last edited by
        #3

        Hello, Thanks for your reply. I studied RFC 1806. But, i didn't solve the problem yet. What i understand is, you r right that filename parameter value is limited to US-ASCII. But i didn't find any range of valid values for "Content-Disposition". Can u send me the range of valid values and how i can use them in "Content-Disposition". Thanks khurram rathor

        M 1 Reply Last reply
        0
        • K khurram rathor

          Hello, Thanks for your reply. I studied RFC 1806. But, i didn't solve the problem yet. What i understand is, you r right that filename parameter value is limited to US-ASCII. But i didn't find any range of valid values for "Content-Disposition". Can u send me the range of valid values and how i can use them in "Content-Disposition". Thanks khurram rathor

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          The "Content-Disposition" described in the RFC 1086 includes 'filename' and 'parameter', where the 'filename' value is limited to US-ASCII, its length is <= 78 characters and the 'parameter' is defined in the [RFC 822,1521]. The RFC 1086 didn't give you much information as its status is experimental, I should have given you the RFC 2183[^], sorry about that. The RFC 2183[^] which updates the RFC 1086 will give you a better look at the "Content-Disposition". This document's category is "Standards Track". In the RFC 2183[^], the "Content-Disposition" is described to have the following parameters: 'filename', 'creation-date', 'modification-date', 'read-date', 'size' and 'parameter'. The paramter value length is a Short value (length <= 78 characters), and basically contains only ASCII characters. For any value which is longer than 78 or contains non-ASCII characters, must be encoded (See RFC 2184[^], 2231[^] for encoding). Here is an example to demonstrate how to use parameters in "Content-Disposition":

          Content-Disposition: attachment; filename=genome.jpeg;
          modification-date="Wed, 12 Feb 1997 16:29:51 -0500";

          For complete information on "Content-Disposition", see RFC 2183[^]. As I said above, parameter values which contain non-ASCII characters must be encoded, for example:

          Content-Type: application/x-stuff;
          title*=UTF-8'vi'T%u00ean%u1ea2R%u1eadp.file

          where the asterisk at the end of the 'title' paramter name indicates that character set and language information may appear at the beginning of the parameter value, a single quote is used to delimit the character set and language information and the actual encoded value.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups