473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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.filesyste mobject")
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?

Jul 22 '05 #1
10 4344
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
nj********@hotmail.com
http://www.nathansokalski.com/

".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
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.filesyste mobject")
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?

Jul 22 '05 #2
".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
: 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.filesyste mobject")
: 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
Jul 22 '05 #3
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:Op**************@TK2MSFTNGP09.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
: 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.filesyste mobject")
: 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

Jul 22 '05 #4
".:mmac:." wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
: 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
Jul 22 '05 #5
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:uG**************@TK2MSFTNGP10.phx.gbl...
".:mmac:." wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
: 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

Jul 22 '05 #6
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:uw**************@TK2MSFTNGP10.phx.gbl...
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:uG**************@TK2MSFTNGP10.phx.gbl...
".:mmac:." wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
: 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


Jul 22 '05 #7
".:mmac:." <lost@sea> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
: 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:uG**************@TK2MSFTNGP10.phx.gbl...
: > ".:mmac:." wrote in message
: > news:%2******************@TK2MSFTNGP09.phx.gbl...
: > : 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

Jul 22 '05 #8
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:Of**************@TK2MSFTNGP14.phx.gbl...
".:mmac:." <lost@sea> wrote in message
news:uw**************@TK2MSFTNGP10.phx.gbl...
: 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:uG**************@TK2MSFTNGP10.phx.gbl...
: > ".:mmac:." wrote in message
: > news:%2******************@TK2MSFTNGP09.phx.gbl...
: > : 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

Jul 22 '05 #9
..: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.
Jul 22 '05 #10
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" <GT**********@spammotel.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
.: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.

Jul 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Petr Prikryl | last post by:
Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error". Current situation: try... (Python 2.4 (#60, ...)) >>> i =...
7
by: James Johnson | last post by:
Are there structs in JavaScript? If not, what's the closest thing, or do I just use parallel arrays? I'm populating a JavaScript array from ColdFusion query, but I don't think I can do this: ...
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
35
by: pandit | last post by:
is this book good for learning C ? i am a beginning programmer, Kernighan and Ritchie 2e is quite hard on me.
0
by: shineyang | last post by:
Dear all: Who is kind to help me about the following problem. Why cannot log the remote node by using Net::Telent #################################### The following is normal to the process...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
5
by: Sendil kumar | last post by:
Hi All, The FtpWebRequest.GetResponse( ) method is not giving "550 File not found exception " when I do a directory list operation on a invalid(not present) directory in HP Unix and Sun Solaris...
1
by: sandeepbhutani304 | last post by:
have 2 projects communicating each other with .NET remoting. But when I am trying to call these functions I am getting the error: The input stream is not a valid binary format. The starting...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.