why is "%2E" showing up instead of the dot?

Discussion in 'ASP General' started by .:mmac:., May 13, 2005.

  1. .:mmac:.

    .:mmac:. Guest

    My ASP page is doing something wierd, I think it has something to do with
    the %2E replacing the dot in the file name But in addition, if I right click
    the link and select "save as", the file extension is duplicated as
    "Week20.pdf.pdf"
    here is the relevant info:

    <%
    set directory=server.createobject("scripting.filesystemobject")
    set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
    ' Lists all the files found in the directory
    For each directoryfile in allFiles.files
    %>
    <a href=MMM/Lesson/ <%
    ' Write out the name of the document
    response.write server.urlencode(directoryfile.name) %>><%
    response.write directoryfile.name %>
    </a>

    This is how it turns up in the source of the published page"

    <a href=MMM/Lesson/
    Week20%2Epdf>Week20.pdf
    </a>

    The "%E2" is something I never noticed before.
    does the code look right?
    what about the duplicated extensions?
    .:mmac:., May 13, 2005
    #1
    1. Advertising

  2. The %2E is there because of the

    server.urlencode(directoryfile.name)

    method. In most cases, this method is not necessary. It is usually only used
    for QueryString techniques, but if all your filenames have is letters,
    numbers, and the period, don't bother with it. I don't know for sure, but
    because the filename has no extension in the code, this may be tricking the
    browser into adding it a second time. After it adds it the second time, it
    then interprets the %2E as a period when you select "save as". So my
    suggestion is get rid of the server.urlencode() method so that your
    generated code looks the way you want, and then see if this fixes the other
    part.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    ".:mmac:." <lost@sea> wrote in message
    news:...
    > My ASP page is doing something wierd, I think it has something to do with
    > the %2E replacing the dot in the file name But in addition, if I right
    > click the link and select "save as", the file extension is duplicated as
    > "Week20.pdf.pdf"
    > here is the relevant info:
    >
    > <%
    > set directory=server.createobject("scripting.filesystemobject")
    > set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
    > ' Lists all the files found in the directory
    > For each directoryfile in allFiles.files
    > %>
    > <a href=MMM/Lesson/ <%
    > ' Write out the name of the document
    > response.write server.urlencode(directoryfile.name) %>><%
    > response.write directoryfile.name %>
    > </a>
    >
    > This is how it turns up in the source of the published page"
    >
    > <a href=MMM/Lesson/
    > Week20%2Epdf>Week20.pdf
    > </a>
    >
    > The "%E2" is something I never noticed before.
    > does the code look right?
    > what about the duplicated extensions?
    >
    >
    >
    Nathan Sokalski, May 13, 2005
    #2
    1. Advertising

  3. .:mmac:.

    Roland Hall Guest

    ".:mmac:." <lost@sea> wrote in message
    news:...
    : My ASP page is doing something wierd, I think it has something to do with
    : the %2E replacing the dot in the file name But in addition, if I right
    click
    : the link and select "save as", the file extension is duplicated as
    : "Week20.pdf.pdf"
    : here is the relevant info:
    :
    : <%
    : set directory=server.createobject("scripting.filesystemobject")
    : set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
    : ' Lists all the files found in the directory
    : For each directoryfile in allFiles.files
    : %>
    : <a href=MMM/Lesson/ <%
    : ' Write out the name of the document
    : response.write server.urlencode(directoryfile.name) %>><%
    : response.write directoryfile.name %>
    : </a>
    :
    : This is how it turns up in the source of the published page"
    :
    : <a href=MMM/Lesson/
    : Week20%2Epdf>Week20.pdf
    : </a>
    :
    : The "%E2" is something I never noticed before.
    : does the code look right?
    : what about the duplicated extensions?

    Why are you encoding it?

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
    Roland Hall, May 13, 2005
    #3
  4. .:mmac:.

    .:mmac:. Guest

    Nathan, Roland,

    The short answer to "why" is because I don't know any better.
    This was an example script I got from this forum a while ago that did what I
    needed it to do which was to list all the files in a directory as clickable
    links.
    I was so excited to have it work I never questioned it.
    What would be a better way?


    "Roland Hall" <nobody@nowhere> wrote in message
    news:Opi$...
    > ".:mmac:." <lost@sea> wrote in message
    > news:...
    > : My ASP page is doing something wierd, I think it has something to do
    > with
    > : the %2E replacing the dot in the file name But in addition, if I right
    > click
    > : the link and select "save as", the file extension is duplicated as
    > : "Week20.pdf.pdf"
    > : here is the relevant info:
    > :
    > : <%
    > : set directory=server.createobject("scripting.filesystemobject")
    > : set allfiles=directory.getfolder(server.mappath("/MMM/Lesson/"))
    > : ' Lists all the files found in the directory
    > : For each directoryfile in allFiles.files
    > : %>
    > : <a href=MMM/Lesson/ <%
    > : ' Write out the name of the document
    > : response.write server.urlencode(directoryfile.name) %>><%
    > : response.write directoryfile.name %>
    > : </a>
    > :
    > : This is how it turns up in the source of the published page"
    > :
    > : <a href=MMM/Lesson/
    > : Week20%2Epdf>Week20.pdf
    > : </a>
    > :
    > : The "%E2" is something I never noticed before.
    > : does the code look right?
    > : what about the duplicated extensions?
    >
    > Why are you encoding it?
    >
    > --
    > Roland Hall
    > /* This information is distributed in the hope that it will be useful, but
    > without any warranty; without even the implied warranty of merchantability
    > or fitness for a particular purpose. */
    > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    > WSH 5.6 Documentation -
    > http://msdn.microsoft.com/downloads/list/webdev.asp
    > MSDN Library - http://msdn.microsoft.com/library/default.asp
    >
    >
    .:mmac:., May 13, 2005
    #4
  5. .:mmac:.

    Roland Hall Guest

    ".:mmac:." wrote in message
    news:%23ehMm4%...
    : Nathan, Roland,
    :
    : The short answer to "why" is because I don't know any better.

    and I thought I was the only one who fell victim to that... (O:=

    : This was an example script I got from this forum a while ago that did what
    I
    : needed it to do which was to list all the files in a directory as
    clickable
    : links.
    : I was so excited to have it work I never questioned it.
    : What would be a better way?

    As Nathan stated, remove the Server.URLEncode() and see if that solves your
    issue. If not, post back and we'll go from there.

    <%
    set directory = Server.CreateObject("Scripting.FileSystemObject")
    set allfiles = directory.GetFolder(Server.MapPath("/mmm/lesson/"))
    For Each directoryfile in allFiles.files
    Response.Write "<a href='/mmm/lesson/" & directoryfile.name & "'>" &
    directoryfile.name & "</a>"
    Next
    %>

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
    Roland Hall, May 13, 2005
    #5
  6. .:mmac:.

    .:mmac:. Guest

    Just remove it?? not replace it with something?? OK will do. I'll let you
    know how it works out monday.

    "Roland Hall" <nobody@nowhere> wrote in message
    news:uG3ZJK$...
    > ".:mmac:." wrote in message
    > news:%23ehMm4%...
    > : Nathan, Roland,
    > :
    > : The short answer to "why" is because I don't know any better.
    >
    > and I thought I was the only one who fell victim to that... (O:=
    >
    > : This was an example script I got from this forum a while ago that did
    > what
    > I
    > : needed it to do which was to list all the files in a directory as
    > clickable
    > : links.
    > : I was so excited to have it work I never questioned it.
    > : What would be a better way?
    >
    > As Nathan stated, remove the Server.URLEncode() and see if that solves
    > your
    > issue. If not, post back and we'll go from there.
    >
    > <%
    > set directory = Server.CreateObject("Scripting.FileSystemObject")
    > set allfiles = directory.GetFolder(Server.MapPath("/mmm/lesson/"))
    > For Each directoryfile in allFiles.files
    > Response.Write "<a href='/mmm/lesson/" & directoryfile.name & "'>" &
    > directoryfile.name & "</a>"
    > Next
    > %>
    >
    > --
    > Roland Hall
    > /* This information is distributed in the hope that it will be useful, but
    > without any warranty; without even the implied warranty of merchantability
    > or fitness for a particular purpose. */
    > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    > WSH 5.6 Documentation -
    > http://msdn.microsoft.com/downloads/list/webdev.asp
    > MSDN Library - http://msdn.microsoft.com/library/default.asp
    >
    >
    .:mmac:., May 13, 2005
    #6
  7. .:mmac:.

    Bob Lehmann Guest

    When you remove the urlencode you will need to enclose your href attribute
    in quotes - which you should have been doing anyway.

    <a href="MMM/Lesson/<% response.write server.urlencode(directoryfile.name)
    %>">

    Otherwise spaces in file names will break the link.

    Bob Lehmann



    ".:mmac:." <lost@sea> wrote in message
    news:...
    > Just remove it?? not replace it with something?? OK will do. I'll let you
    > know how it works out monday.
    >
    > "Roland Hall" <nobody@nowhere> wrote in message
    > news:uG3ZJK$...
    > > ".:mmac:." wrote in message
    > > news:%23ehMm4%...
    > > : Nathan, Roland,
    > > :
    > > : The short answer to "why" is because I don't know any better.
    > >
    > > and I thought I was the only one who fell victim to that... (O:=
    > >
    > > : This was an example script I got from this forum a while ago that did
    > > what
    > > I
    > > : needed it to do which was to list all the files in a directory as
    > > clickable
    > > : links.
    > > : I was so excited to have it work I never questioned it.
    > > : What would be a better way?
    > >
    > > As Nathan stated, remove the Server.URLEncode() and see if that solves
    > > your
    > > issue. If not, post back and we'll go from there.
    > >
    > > <%
    > > set directory = Server.CreateObject("Scripting.FileSystemObject")
    > > set allfiles = directory.GetFolder(Server.MapPath("/mmm/lesson/"))
    > > For Each directoryfile in allFiles.files
    > > Response.Write "<a href='/mmm/lesson/" & directoryfile.name & "'>" &
    > > directoryfile.name & "</a>"
    > > Next
    > > %>
    > >
    > > --
    > > Roland Hall
    > > /* This information is distributed in the hope that it will be useful,

    but
    > > without any warranty; without even the implied warranty of

    merchantability
    > > or fitness for a particular purpose. */
    > > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    > > WSH 5.6 Documentation -
    > > http://msdn.microsoft.com/downloads/list/webdev.asp
    > > MSDN Library - http://msdn.microsoft.com/library/default.asp
    > >
    > >

    >
    >
    Bob Lehmann, May 14, 2005
    #7
  8. .:mmac:.

    Roland Hall Guest

    ".:mmac:." <lost@sea> wrote in message
    news:...
    : Just remove it?? not replace it with something?? OK will do. I'll let you
    : know how it works out monday.
    :
    : "Roland Hall" <nobody@nowhere> wrote in message
    : news:uG3ZJK$...
    : > ".:mmac:." wrote in message
    : > news:%23ehMm4%...
    : > : Nathan, Roland,
    : > :
    : > : The short answer to "why" is because I don't know any better.
    : >
    : > and I thought I was the only one who fell victim to that... (O:=
    : >
    : > : This was an example script I got from this forum a while ago that did
    : > what
    : > I
    : > : needed it to do which was to list all the files in a directory as
    : > clickable
    : > : links.
    : > : I was so excited to have it work I never questioned it.
    : > : What would be a better way?
    : >
    : > As Nathan stated, remove the Server.URLEncode() and see if that solves
    : > your
    : > issue. If not, post back and we'll go from there.
    : >
    : > <%
    : > set directory = Server.CreateObject("Scripting.FileSystemObject")
    : > set allfiles = directory.GetFolder(Server.MapPath("/mmm/lesson/"))
    : > For Each directoryfile in allFiles.files
    : > Response.Write "<a href='/mmm/lesson/" & directoryfile.name & "'>" &
    : > directoryfile.name & "</a>"
    : > Next
    : > %>
    :
    I listed the modification for you to test with.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
    Roland Hall, May 14, 2005
    #8
  9. .:mmac:.

    .:mmac:. Guest

    Oops, so you did, Sorry about that.
    It works perfectly now, thank you so much!
    I will post another question about sorting the list in another thread.
    Thank you all.

    "Roland Hall" <nobody@nowhere> wrote in message
    news:...
    > ".:mmac:." <lost@sea> wrote in message
    > news:...
    > : Just remove it?? not replace it with something?? OK will do. I'll let
    > you
    > : know how it works out monday.
    > :
    > : "Roland Hall" <nobody@nowhere> wrote in message
    > : news:uG3ZJK$...
    > : > ".:mmac:." wrote in message
    > : > news:%23ehMm4%...
    > : > : Nathan, Roland,
    > : > :
    > : > : The short answer to "why" is because I don't know any better.
    > : >
    > : > and I thought I was the only one who fell victim to that... (O:=
    > : >
    > : > : This was an example script I got from this forum a while ago that
    > did
    > : > what
    > : > I
    > : > : needed it to do which was to list all the files in a directory as
    > : > clickable
    > : > : links.
    > : > : I was so excited to have it work I never questioned it.
    > : > : What would be a better way?
    > : >
    > : > As Nathan stated, remove the Server.URLEncode() and see if that solves
    > : > your
    > : > issue. If not, post back and we'll go from there.
    > : >
    > : > <%
    > : > set directory = Server.CreateObject("Scripting.FileSystemObject")
    > : > set allfiles = directory.GetFolder(Server.MapPath("/mmm/lesson/"))
    > : > For Each directoryfile in allFiles.files
    > : > Response.Write "<a href='/mmm/lesson/" & directoryfile.name & "'>" &
    > : > directoryfile.name & "</a>"
    > : > Next
    > : > %>
    > :
    > I listed the modification for you to test with.
    >
    > --
    > Roland Hall
    > /* This information is distributed in the hope that it will be useful, but
    > without any warranty; without even the implied warranty of merchantability
    > or fitness for a particular purpose. */
    > Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    > WSH 5.6 Documentation -
    > http://msdn.microsoft.com/downloads/list/webdev.asp
    > MSDN Library - http://msdn.microsoft.com/library/default.asp
    >
    >
    >
    .:mmac:., May 15, 2005
    #9
  10. ..:mmac:. wrote:
    > My ASP page is doing something wierd, I think it has something to do
    > with the %2E replacing the dot in the file name But in addition, if I
    > right click the link and select "save as", the file extension is
    > duplicated as "Week20.pdf.pdf"
    > ...
    > <a href=MMM/Lesson/ <%
    > response.write server.urlencode(directoryfile.name) %>><%
    > response.write directoryfile.name %>
    > </a>


    Are you just concerned about the way the text reads, or is this functionally
    inoperable? When you use non-standard characters (such as spaces),
    URLEncoding is necessary to conform to the recommendations in RFC1630:

    Unsafe characters
    In canonical form, certain characters such as spaces,
    control characters, some characters whose ASCII code is
    used differently in different national character variant
    7 bit sets, and all 8bit characters beyond DEL (7F hex)
    of the ISO Latin-1 set, shall not be used unencoded. This
    is a recommendation for trouble-free interchange, and as
    indicated below, the encoded set may be extended or
    reduced.

    http://www.ietf.org/rfc/rfc1630.txt



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, May 16, 2005
    #10
  11. .:mmac:.

    .:mmac:. Guest

    I was mostly concerned with it's appearance , but the side effect of having
    two extensions in the "save as" function rendered it useless. There were no
    spaces or odd characters used and the fix proposed (not encoding) did
    resolve the problem.
    now if I could just sort them properly...


    "Dave Anderson" <> wrote in message
    news:...
    > .:mmac:. wrote:
    >> My ASP page is doing something wierd, I think it has something to do
    >> with the %2E replacing the dot in the file name But in addition, if I
    >> right click the link and select "save as", the file extension is
    >> duplicated as "Week20.pdf.pdf"
    >> ...
    >> <a href=MMM/Lesson/ <%
    >> response.write server.urlencode(directoryfile.name) %>><%
    >> response.write directoryfile.name %>
    >> </a>

    >
    > Are you just concerned about the way the text reads, or is this
    > functionally inoperable? When you use non-standard characters (such as
    > spaces), URLEncoding is necessary to conform to the recommendations in
    > RFC1630:
    >
    > Unsafe characters
    > In canonical form, certain characters such as spaces,
    > control characters, some characters whose ASCII code is
    > used differently in different national character variant
    > 7 bit sets, and all 8bit characters beyond DEL (7F hex)
    > of the ISO Latin-1 set, shall not be used unencoded. This
    > is a recommendation for trouble-free interchange, and as
    > indicated below, the encoded set may be extended or
    > reduced.
    >
    > http://www.ietf.org/rfc/rfc1630.txt
    >
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.
    > Use of this email address implies consent to these terms. Please do not
    > contact me directly or ask me to contact you directly for assistance. If
    > your question is worth asking, it's worth posting.
    >
    .:mmac:., May 16, 2005
    #11
    1. Advertising

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. Samuël van Laere

    To dot or not to dot?

    Samuël van Laere, Oct 16, 2003, in forum: HTML
    Replies:
    8
    Views:
    410
    Samuël van Laere
    Oct 16, 2003
  2. Christopher M. Lusardi

    volatile struct in dot h vs dot c

    Christopher M. Lusardi, May 11, 2004, in forum: C Programming
    Replies:
    3
    Views:
    460
    Peter Shaggy Haywood
    May 15, 2004
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,733
    Smokey Grindel
    Dec 2, 2006
  4. Nathan Sokalski
    Replies:
    11
    Views:
    682
    AAaron123
    Aug 14, 2009
  5. Replies:
    6
    Views:
    222
    Thomas 'PointedEars' Lahn
    Dec 12, 2005
Loading...

Share This Page