Downloading file from IE8 replaces spaces with underscores


  1. Posts : 1
    Windows 7
       #1

    Downloading file from IE8 replaces spaces with underscores


    Hi All,

    When I download a file from IE8, if the file name has spaces, the spaces turn to underscores. IE 8 is fully updated, and so is my Windows 7 Pro. Couldn't find a solution any where, any help would be great.

    Thanks
      My Computer


  2. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #2

    Hello Helpo11, welcome to the Seven Forums.

    Downloading files from Internet using Internet Explorer is not replacing spaces with underscores, they are there to start with. It is not an error or bug but instead completely normal behavior. I will try to explain it, as well as tell you how to avoid those underscores. Please read patiently to the end, it is necessary first to understand why this happens so my explanation might be a bit long...

    A so called Internet address is called URL (Uniform Resource Locator,). For instance the Seven Forums URL is https://www.sevenforums.com. A URL consists of a protocol identifier and a domain name. Most common protocols are HTTP (Hypertext Transfer Protocol), HTTPS (Hypertext Transfer Protocol Secure), FTP (File Transfer Protocol) and FILE for internal file system.

    More about FILE protocol identifier to better understand my example below:
    You can browse your Windows computer with any browser using URL, try for instance writing file:///C:/ on your browser's addressbar and see what happens! Notice that URL starting with FILE is followed by 3 shlashes ///, not two as other URLs. First two slashes belong to protocol identifier, the third one is to tell to system browsing starts from root.

    When you click a download link on a web page, it is also a URL. Look for instance the Giveaway of the Day site (gives daily one application for free), their freebie today is a program called Tilt Shift Generator. From the site you can find this download link:

    Downloading file from IE8 replaces spaces with underscores-download_url_example_1.png

    When you click the link it starts downloading. This is because when your browser does not recognize the extension of a link (URL) to be one that should be opened on browser, it correctly assumes that this URL is file to be downloaded. Typical extensions that just open a webpage are .html, .htm, .php, .asp and so on. Extensions .exe, .zip and .rar are typical examples of "downloadable" extensions.

    Now the most important thing regarding this matter: A URL can not have spaces!. The same with the name of a downloadable file on a website, it can not contain spaces.

    An example:
    I am browsing my PC being at the moment in folder I:\Recorded TV backup\TV. I want to continue browsing with browser. I simply right click Windows Explorer addressbar and copy the address:

    Downloading file from IE8 replaces spaces with underscores-download_url_example_3.png

    Now let's paste the address to browser addressbar. As this address (folder path) contains spaces which are not allowed in a URL, they must be converted to something a browser can understand before the folder path can be used as a URL. This conversion is done by system, automatically. See the addressbar, the URL system has encoded every space to characters %20, ASCII code for a space:

    Downloading file from IE8 replaces spaces with underscores-download_url_example_2.png

    This, replacing spaces and other special characters on URLs to something the system can understand is called URL encoding or Percent encoding. A complete list of ASCII codes for all characters as well as more information in this matter can be found on this page.

    Finally, your answer :
    Those underscores are there to start with. As an old school geek from the times when spaces in filenames were absolutely forbidden, I as well as most of the geeks still don't use them. We replace spaces in filenames with underscores to make them one word. See what I mean, scroll up to the one of the screenshots in this post, hover your cursor on top of the image to see the filename I gave to that image. See?

    A clickable link is often underlined so it is easy not to notice the underscore. Here a bogus link for example: www.anexamplesite.com/download_this_file. Noticed the underscores?

    When you click these downloadable links on IE8 and later notice that the filename contains underscores, it is because it was originally there. IE does not change the filename when you download it.

    To get rid of underscores, do not select Save when downloading. Select Save As instead and replace underscores with spaces, or change the filename to whatever you'd like to.

    Kari
    Last edited by Kari; 08 Jan 2013 at 18:56. Reason: Added links.
      My Computer


  3. Posts : 10,485
    W7 Pro SP1 64bit
       #3

    helpo11 said:
    Hi All,

    When I download a file from IE8, if the file name has spaces, the spaces turn to underscores. IE 8 is fully updated, and so is my Windows 7 Pro. Couldn't find a solution any where, any help would be great.

    Thanks
    As Kari has explained - spaces are not allowed in a URL path...

    ...however IE8 should turn the "%20" that Kari mentioned back into a space for you.

    Most links have an underscore under the file name which would hide any underscores might be in the original file name.

    Start with a file name like:
    "some image.jpg"
    You might see the link as:
    "some image.jpg"

    Or I can start with a file name like:
    "some_image.jpg"
    You might see the link as:
    "some_image.jpg"

    How can you be sure that the original file has spaces in its file name? Are you seeing one or more "%20" replacements as shown in the first image below?

    Please visit this website that I found via a random Google for "Index of":
    http://www.nfsa.tv/tv_videos/

    Both IE9 and IE8 downloaded the file shown below and the resulting file had spaces in the name:

    Downloading file from IE8 replaces spaces with underscores-spaced-out1.png

    Downloading file from IE8 replaces spaces with underscores-spaced-out2.png

    Please provide a link to a file that demonstrates the problem that you are having?
      My Computer


  4. Posts : 17,545
    Windows 10 Pro x64 EN-GB
       #4

    UsernameIssues said:
    As Kari has explained - spaces are not allowed in a URL path...

    ...however IE8 should turn the "%20" that Kari mentioned back into a space for you.

    Most links have an underscore under the file name which would hide any underscores might be in the original file name.

    ...
    ...
    Important addition, I forgot to mention that. Thanks.

    As UsernameIssues told, URI Encoding works two ways. If a URL has encoded characters like %20 for a space, when the file is downloaded the %20 is re-converted to space.

    My main point is still valid after what UsernameIssues added: IE does not replace spaces with underscores.

    Kari
      My Computer


  5. Posts : 1
    Windows 7 64bit
       #5

    Hi I have been searching as to why IE is changing my hyperlinks with # to %20 when I found this thread and hope you can help me. I understand why the underscores are there my issue is when I add a hyperlink to a word document that has underscores it alters the hyperlink from # to %20. Here is an example
    Social Security Act 1991 to http://www.comlaw.gov.au/Details/C20...0_Toc399337376 and this causes errors. My own IT staff are not able to answer this for me. The only reason I can think of is that as it is not the start of the page it is further down using the pages TOC this is causes this issue..... Please help.
      My Computer


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    Hmmm Kaos239, you sure came up with an interesting issue (bug?).


    I was able to reproduce your issue using IE11 on W7pro64bit. I then used Process Monitor to capture some of what goes on when one clicks on such a link from within an MS Word (Office 2010) document.
    Downloading file from IE8 replaces spaces with underscores-ie11-1.png

    I made Chrome the default browser and this is what Process Monitor captured when one clicks on the link.
    Downloading file from IE8 replaces spaces with underscores-chrome.png
    (Notice that there is no CreateFile operation.)

    When I put IE back as the default browser, the process worked.
    (i.e. IE11 opened the website to the correct location.)
    Downloading file from IE8 replaces spaces with underscores-ie11-2.png

    All of the Process Monitor captures pictured above were filtered to only show entries that contained "comlaw" in the Path.


    So... I started all over.
    I opened a W7pro64bit Virtual Machine
    ...installed/updated IE11
    ...installed MS Office 2010
    ...opened Word and pasted in your link.

    Sure enough, IE11 failed.
    Word sent "%20-%20" instead of "#".
    Notice the hyphen between the each "%20".

    Installing Chrome fixed the issue...
    ...even when IE11 was set as the default browser again
    ...even when Chrome was uninstalled
    ...even after restarting the virtual computer.
    Nothing could break IE11 once Chrome had been the default browser. Unfortunately, Chrome changes a boatload of stuff in the Windows registry and we have known for a long time that uninstalling Chrome leaves stuff behind in the registry.

    I'm afraid that I cannot help you fix this - unless you want to tell all of those that get your Word document to install Chrome, make it the default browser and then uninstall Chrome.

    Code:
    http://www.comlaw.gov.au/Details/C2014C00682/Html/Volume_3#_Toc399337377
    edit: you are not alone in reporting this:
    http://answers.microsoft.com/en-us/o...1e296d4?page=1

    The registry entry near the bottom of page one is one of the things that I've seen after Chrome touches a computer. I find it interesting that some users in that thread seemed to have the issue even when using Chrome as the default browser.
      My Computer


  7. Posts : 20,583
    Win-7-Pro64bit 7-H-Prem-64bit
       #7

    Interesting stuff,
    All I can say is word 2007 when creating a hyperlink paste as save text only will show the correct url to the section in the drop down menu,
    Attachment 336878
    That was off the section below where your link pointed to,
    Code:
    style="width:20px;height:1px"></div></td><td><divstyle="width:20px;height:1px"></div></td><td><divstyle="width:20px;height:1px"></div></td><td><divstyle="width:20px;height:1px"></div></td><td><divstyle="width:20px;height:1px"></div></td><td><imgsrc="/WebResource.axd?d=VCF9irJdZc_LjMfCWQn6-QpbGpsZhz0oL8lU5ywN8D_sIAjLUqWzjsx-uiZKNHsAPgMdkafFDtDGfjMv2CFD1jM5BcCOObdKf9yJ4ZxmoPvj44Kw0&amp;t=635296337968570163"alt=""/></td><tdclass="tree ctl00_MainContent_ctl05_HtmlToc_trTOC_2"style="white-space:nowrap;"><aclass="ctl00_MainContent_ctl05_HtmlToc_trTOC_0 tree ctl00_MainContent_ctl05_HtmlToc_trTOC_1"href="http://www.comlaw.gov.au/Details/C2014C00682/Html/Volume_3#_Toc399337338"title="1119 Value of asset-tested income streams that are not defined benefit income streams"id="ctl00_MainContent_ctl05_HtmlToc_trTOCt1853"style="border-style:none;font-size:1em;">1119 Value of asset-tested income streams that are not defined benefit income streams</a></td>
    Last edited by ThrashZone; 22 Feb 2015 at 19:59.
      My Computer


  8. Posts : 1
    windows 7
       #8

    Kaos239 said:
    Hi I have been searching as to why IE is changing my hyperlinks with # to %20 when I found this thread and hope you can help me. I understand why the underscores are there my issue is when I add a hyperlink to a word document that has underscores it alters the hyperlink from # to %20. Here is an example
    Social Security Act 1991 to http://www.comlaw.gov.au/Details/C20...0_Toc399337376 and this causes errors. My own IT staff are not able to answer this for me. The only reason I can think of is that as it is not the start of the page it is further down using the pages TOC this is causes this issue..... Please help.


    Try this simple registry change under local user settings, one for HTTP and HTTPS

    You could try setting these registry keys, the changes solved my problem and it is better then change 300+ docs with multiple hyperlinks:

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ add key "http"]
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\add key "UserChoice"]
    add a new string "Progid" with a value ="IE.HTTP"


    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ add key "https"]
    [HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\ add key "UserChoice"]
    add a new string "Progid" with a value ="IE.HTTPS"


    Thank you Erik Davidsson and now I need to sign up to MS site to thank that fella.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:05.
Find Us