how to display a file name correctly when I click open attached fi

Discussion in 'Internet Explorer' started by flyhammer, Jan 20, 2009.

  1. flyhammer

    flyhammer Guest

    ** test spec **
    - ASP
    - Based on UTF-8
    - multilingual file download ( Especially Korean, Japanese, Chinanese etc. )
    - IE 7.0

    Hello~ Guy.

    Now I'm just make to download multilingual files(UTF-8) using
    Response.BinaryWrite.
    Although (Fortunately) I can make a multilingual file download work, I'm
    just faced up to an unexpected difficulty.

    when I click "open button" to check attached multilingual file although the
    filename is shown correctly on the filedownload dialog, Actually the file
    name is shown as %EC%84%B8%EC%9D%BC%EB%9F%AC[1].doc on ms-word. ('Save as'
    shows the correct name)

    So, I look forward to finding the solution how to be accurately displayed
    the filename when I click "open button" whihout saving.

    If you know the mean I wish to know, plese give me some guide to solve this
    problem.
    Or, any recommnad is accepted any component or web browser to support the
    function to be displayed filename correctly when I open the attached file.
    (* Maybe I wonder how to solve this problem by any other Server-side
    Language( JSP, ASP.NET etc )

    as far as here, it's all my problem.
    From now on, I just wait your opinion. thank you~.

    Sample Code
    ================================
    <%@ Language=VBScript%>
    <%

    old_codepage = Session.CodePage
    Session.CodePage = "65001"

    file = "세ì¼ëŸ¬.doc" '%EC%84%B8%EC%9D%BC%EB%9F%AC[1].doc

    encodename = Server.UrlEncode(file)
    delimiter = InStrRev(encodename, "%2E")

    if delimiter <> 0 then
    tempname = Left ( encodename, delimiter - 1 )
    temptype = Right ( encodename, Len(encodename) - delimiter - 2 )
    encodename = replace( tempname & "." & temptype, "+" ,"%20" )
    end if

    Response.ContentType = "application/unknown"
    Response.AddHeader "Content-Disposition","attachment; filename=" &
    encodename

    Set objStream = Server.CreateObject("ADODB.Stream")

    objStream.Open
    objStream.Type = 1
    objStream.LoadFromFile Server.MapPath("./data/")&"\"& file

    download = objStream.Read
    Response.BinaryWrite download

    Set objstream = nothing

    %>
     
    flyhammer, Jan 20, 2009
    #1
    1. Advertisements

  2. See these MSDN pages: http://msdn2.microsoft.com/en-us/ie/default.aspx and
    http://msdn.microsoft.com/en-us/library/ms537623.aspx and
    http://msdn2.microsoft.com/en-us/ie/aa740476.aspx

    You can also post here instead:

    MSDN IE Development Forums
    http://forums.microsoft.com/MSDN/default.aspx?ForumGroupID=253&SiteID=1
    --
    ~Robear Dyer (PA Bear)
    MS MVP-IE, Mail, Security, Windows Desktop Experience - since 2002
    AumHa VSOP & Admin http://aumha.net
    DTS-L http://dts-l.net/

    flyhammer wrote:
    > ** test spec **
    > - ASP
    > - Based on UTF-8
    > - multilingual file download ( Especially Korean, Japanese, Chinanese
    > etc. )
    > - IE 7.0
    >
    > Hello~ Guy.
    >
    > Now I'm just make to download multilingual files(UTF-8) using
    > Response.BinaryWrite.
    > Although (Fortunately) I can make a multilingual file download work, I'm
    > just faced up to an unexpected difficulty.
    >
    > when I click "open button" to check attached multilingual file although
    > the
    > filename is shown correctly on the filedownload dialog, Actually the file
    > name is shown as %EC%84%B8%EC%9D%BC%EB%9F%AC[1].doc on ms-word. ('Save as'
    > shows the correct name)
    >
    > So, I look forward to finding the solution how to be accurately displayed
    > the filename when I click "open button" whihout saving.
    >
    > If you know the mean I wish to know, plese give me some guide to solve
    > this
    > problem.
    > Or, any recommnad is accepted any component or web browser to support the
    > function to be displayed filename correctly when I open the attached file.
    > (* Maybe I wonder how to solve this problem by any other Server-side
    > Language( JSP, ASP.NET etc )
    >
    > as far as here, it's all my problem.
    > From now on, I just wait your opinion. thank you~.
    >
    > Sample Code
    > ================================
    > <%@ Language=VBScript%>
    > <%
    >
    > old_codepage = Session.CodePage
    > Session.CodePage = "65001"
    >
    > file = "세ì¼ëŸ¬.doc" '%EC%84%B8%EC%9D%BC%EB%9F%AC[1].doc
    >
    > encodename = Server.UrlEncode(file)
    > delimiter = InStrRev(encodename, "%2E")
    >
    > if delimiter <> 0 then
    > tempname = Left ( encodename, delimiter - 1 )
    > temptype = Right ( encodename, Len(encodename) - delimiter - 2 )
    > encodename = replace( tempname & "." & temptype, "+" ,"%20" )
    > end if
    >
    > Response.ContentType = "application/unknown"
    > Response.AddHeader "Content-Disposition","attachment; filename=" &
    > encodename
    >
    > Set objStream = Server.CreateObject("ADODB.Stream")
    >
    > objStream.Open
    > objStream.Type = 1
    > objStream.LoadFromFile Server.MapPath("./data/")&"\"& file
    >
    > download = objStream.Read
    > Response.BinaryWrite download
    >
    > Set objstream = nothing
    >
    > %>
     
    PA Bear [MS MVP], Jan 20, 2009
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.