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

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jaris
    Replies:
    0
    Views:
    934
    Jaris
    Mar 27, 2006
  2. Michel Merlin

    Open in New Window = Shift+Click, in New Tab = Ctrl+Click

    Michel Merlin, Nov 28, 2006, in forum: Internet Explorer
    Replies:
    6
    Views:
    543
    rgilinsky
    Dec 24, 2006
  3. ---> Will2J
    Replies:
    3
    Views:
    606
    Jonathan Kay [MVP]
    May 1, 2006
  4. thomas
    Replies:
    1
    Views:
    693
    Michael Santovec
    May 24, 2009
  5. thebigdintexas

    Click to open, click to close

    thebigdintexas, Mar 28, 2007, in forum: Windows Live Messenger
    Replies:
    1
    Views:
    333
    Jonathan Kay [MVP]
    Mar 29, 2007
  6. B Walker
    Replies:
    3
    Views:
    691
    B Walker
    Dec 6, 2004
  7. Dave Mc

    Display Name - Change users email display name

    Dave Mc, Aug 7, 2007, in forum: Windows Small Business Server
    Replies:
    3
    Views:
    2,127
    Steve Foster [SBS MVP]
    Aug 8, 2007
  8. Replies:
    1
    Views:
    793
    Yevgen Lazaryev
    Sep 2, 2004
Loading...