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. Filename getting currepted when downloading a file with filename having french characters

Filename getting currepted when downloading a file with filename having french characters

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 2 Posters 0 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.
  • J Offline
    J Offline
    jophinmichael
    wrote on last edited by
    #1

    Hi , I am downloading a file with filename having french characters . My code is like this , strFilename = "dossier de téléchargement.docx" Response.AddHeader("Content-Disposition", "attachment;filename=""" &strFilename) But when we are using Internet Explorer after downloading , the filename is converted to 'dossier_de_téléchargement.docx' . Please help Thanks in advance Jophin

    jophin

    A 1 Reply Last reply
    0
    • J jophinmichael

      Hi , I am downloading a file with filename having french characters . My code is like this , strFilename = "dossier de téléchargement.docx" Response.AddHeader("Content-Disposition", "attachment;filename=""" &strFilename) But when we are using Internet Explorer after downloading , the filename is converted to 'dossier_de_téléchargement.docx' . Please help Thanks in advance Jophin

      jophin

      A Offline
      A Offline
      Artem Kustikov
      wrote on last edited by
      #2

      Try to use HttpUtility.UrlEncode to encode file name:

      strFilename = HttpUtility.UrlEncode("dossier de téléchargement.docx");

      J 1 Reply Last reply
      0
      • A Artem Kustikov

        Try to use HttpUtility.UrlEncode to encode file name:

        strFilename = HttpUtility.UrlEncode("dossier de téléchargement.docx");

        J Offline
        J Offline
        jophinmichael
        wrote on last edited by
        #3

        hi Artem, I tried this . Now the filename is proper but spaces are replaced by '+' signs. Is there any solution for that .Thanks in advance .Please dont consider my poor english . Regards Jophin

        jophin

        A 1 Reply Last reply
        0
        • J jophinmichael

          hi Artem, I tried this . Now the filename is proper but spaces are replaced by '+' signs. Is there any solution for that .Thanks in advance .Please dont consider my poor english . Regards Jophin

          jophin

          A Offline
          A Offline
          Artem Kustikov
          wrote on last edited by
          #4

          '+' is a valid replacement for space symbol(' '), quick way to fix it - use String.Replace:

          strFilename = HttpUtility.UrlEncode("dossier de téléchargement.docx")
          .Replace("+", "%20");

          J 1 Reply Last reply
          0
          • A Artem Kustikov

            '+' is a valid replacement for space symbol(' '), quick way to fix it - use String.Replace:

            strFilename = HttpUtility.UrlEncode("dossier de téléchargement.docx")
            .Replace("+", "%20");

            J Offline
            J Offline
            jophinmichael
            wrote on last edited by
            #5

            Hi Artem, Thank you for the immediate reply . But now I am using Server.UrlPathEncode() . It works fine. Regards Jophin

            jophin

            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