Ask a questionAsk a question
 

QuestionIE7 ile download replaces spaces with underscore (_)

  • Monday, November 20, 2006 1:57 PMDave198026 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    First post here so hello to all first of all

    I have a question which i cant seem to find an answer for no matter how hard i search.

    Basically, i just want to turn off the functionality that replaces the spaces with underscores when downloading a file from IE7.

    I would think it is possible but i just cant find the answer.

    Hope someone can help,

    Thanks in advance,

    Dave

All Replies

  • Friday, November 24, 2006 12:56 AMriverthames Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Dave,

    I have exactly the same problem with each space characters in the filename replaced by an underscore character - note this is just within the filename itself (the contents of the file are okay) during a 'file save as' download.

    I notice that the # character is also replaced by an underscore.

    Only upgraded to IE7 today and this is the first problem identified but I have not been able to see which option to modify.

    Is this a font/language setting translation issue?

    Hopefully someone will explain it to both of us!

    Thanks,

    Jeff.

  • Thursday, November 30, 2006 4:14 PMDave198026 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Jeff,

    Glad its not just me!  Did you manage to find a fix in the end?

    Does anybody else know how to turn this option off?

    Thanks

    Dave

  • Tuesday, December 12, 2006 9:51 PMJohn Conway Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Dave,

    We too have spaces being replaced by underscores.  Users of our application do a checkout (download) followed by a checkin (upload), and new files are being created in the repository rather than old ones being updated.  So we too need a fix or workaround.

    John

  • Wednesday, December 13, 2006 2:22 PMDavid JH Robinson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've come across this myself. If you are able to change the spaces to %20s then IE7 will convert them correctly. Firefox though will take them literally ( at least when using the Content-disposition header) so you will need to do this for requests from IE7 only.

    We did the following in our app. ( a tomcat based document repository)

        String userAgent = request.getHeader("User-Agent");
        if (userAgent.contains("MSIE 7.0")) {
            filename = filename.replace(" ", "%20");   
        }        
        response.addHeader("Content-disposition", "attachment;filename=\"" + filename+"\"");
  • Wednesday, December 13, 2006 8:21 PMJohn Conway Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Dave,

    Thanks so much for the help.

    Late yesterday, I experimented with some other special characters and verified that # also gets replaced by a space ... and ; truncates everything in the file name to the right! So, I expanded on your solution as follows. (Delphi code)

    // test for ie7.0 here, if yes
    saveAsFileName := URLEncodePath(saveAsFileName);
    PutHttpHeader('Content-Disposition', 'attachment; filename="' + saveAsFileName + '"');

    // and the referenced function is as follows:

    function UrlEncodePath(const S: string): string;
    var
    I: longInt;
    Hex: string;
    begin
    result := '';
    for I := 1 to Length(S) do
    begin
    case SIdea of
    'a'..'z', 'A'..'Z', '0'..'9', '.', '/', ':':
    result := result + SIdea;
    '\':
    result := result + '/';
    else
    begin
    Hex := IntToHex(ord(SIdea), 2);
    if Length(Hex) < 2 then
    Hex := '0' + Hex;
    result := result + '%' + Hex;
    end;
    end;
    end;
    end;

    (I don't know why the light bulb, but replace it with "left brace, i right brace" (omit quotes)).

    This function copies standard URL characters as is, replaces \ with /, and coverts any other character to its %hh representation.

    The above worked for downloads with a space, # and ; in the file name. Can't promise it works in every situation, but I hope it might be useful to others encountering the same problem.

    John
  • Saturday, December 23, 2006 8:25 AMOracl3 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Dear All

     

    I think the question is not answer yet..

    "Does anybody else know how to turn this option off?"

    Help me too.. with this problem

     

    Regards..

  • Wednesday, January 03, 2007 9:43 AMDave198026 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi All,

    I finally managed to track down some kind of answer to if this can be switched off... and it seems it cannot.

    However, there does seem to be quite a simple fix for it (along the same line of what john conway suggested above but just converts the spaces).  You can read the thread here:

    http://groups.google.co.uk/group/microsoft.public.internetexplorer.general/browse_thread/thread/d29c6cf6f78a0f0f/16250eac2a0b3372%2316250eac2a0b3372

    Thanks for all your replies.

    Cheers

    Dave

  • Tuesday, October 23, 2007 12:17 PMMikael_Puittinen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    We are having this issue with IE 7 and our web application. The fixes listed above seem to work when selecting "Save" from the download dialog but when selecting "Open" for e.g. a Word document, the fix breaks the filename by including the %20Tongue Tied in the filename.

    Basically, according to our research, current options for MSIE 7 and handling filenames are:

    1) not encoding the headers: "Open" works, "Save as" replaces special characters by underscores
    2) encoding the headers: "Open" includes the encodings (e.g. %20 etc.) in the filenames and "Save as" works.

    Is there any workaround for these issues apart from waiting for a new version of IE 7 that hopefully fixes this issue (or starting to write a download agent in Java that ensures that the built-in mechanisms within IE 7 are not used for file downloads)?

    Thanks for any help

  • Wednesday, July 02, 2008 10:15 AMJUDACIOUS Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Mikael,

    Please let me know if you found the solution for this issue with the workaround.
    1) not encoding the headers: "Open" works, "Save as" replaces special characters by underscores
    2) encoding the headers: "Open" includes the encodings (e.g. %20 etc.) in the filenames and "Save as" works.

    Thanks,

    ~JUDA
  • Tuesday, February 10, 2009 9:50 PMpalswim Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Microsoft claims to have a hotfix for this bug, which would solve many a user's problems.  But, for some reason, I can't install it (it tells me that I don't need to install it since my computer already has newer updates).  Yet, I check the DLL Microsoft includes in the hotfix and the DLL on my system (wininet.dll) and the DLL on my system is older than the DLL in the hotfix.  I try to manually overwrite the DLL, but the System File Protection works way too well.
    • Edited bypalswim Tuesday, February 10, 2009 9:51 PMGrammar
    •