473,796 Members | 2,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Spaces in parameter

I know it's terribly incorrect (well I think I know) to use something
like
<a href="bla.php?t itle=hello world">Hello World</a>
but can I safely do this?

I have an Apache Linux server with Blogger running, and I want to find
a way to make users go to my discussion forum, but to automatically
insert a link into the title of a new thread. Please see
<http://blog.outer-court.com> as an example, and when you click on
discuss you are taken to <http://blog.outer-court.com/forum/> which is
a PHP script.

I do not have any method (I believe) to let the pages be generated by
the Blogger template and include the title with correctly %20 encoded
spaces. I'm sure above will work in IExplorer as does many broken HTML.

Any help appreciated.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #1
10 8648

"Philipp Lenssen" <in**@outer-court.com> wrote in message
news:2j******** ****@uni-berlin.de...
I know it's terribly incorrect (well I think I know) to use something
like
<a href="bla.php?t itle=hello world">Hello World</a>
but can I safely do this?

I have an Apache Linux server with Blogger running, and I want to find
a way to make users go to my discussion forum, but to automatically
insert a link into the title of a new thread. Please see
<http://blog.outer-court.com> as an example, and when you click on
discuss you are taken to <http://blog.outer-court.com/forum/> which is
a PHP script.

I do not have any method (I believe) to let the pages be generated by
the Blogger template and include the title with correctly %20 encoded
spaces. PHP certainly does have such a method, though I don't recall it offhand.
Seems like the kind of thing you would ask, though, in a PHP forum.
I'm sure above will work in IExplorer as does many broken HTML.


This isn't an HTML matter, it's about the URI standard.

Jul 20 '05 #2
Philipp Lenssen wrote:
I know it's terribly incorrect (well I think I know) to use something
like
<a href="bla.php?t itle=hello world">Hello World</a>
It's incorrect insofar as it's a violation of the spec.
but can I safely do this?


Dunno.

--
Jock
Jul 20 '05 #3
/Philipp Lenssen/:
I know it's terribly incorrect (well I think I know) to use something
like
<a href="bla.php?t itle=hello world">Hello World</a>
but can I safely do this?


A clever UA would automatically encode the spaces prior making the
request, but AFAIK it is not a requirement on its side, so if you
want to play it safe - just encode the specified text.

--
Stanimir
Jul 20 '05 #4
Philipp Lenssen wrote:
I know it's terribly incorrect (well I think I know) to use something
like
<a href="bla.php?t itle=hello world">Hello World</a>
but can I safely do this?

Because it's a URI, escape the space:
<a href="bla.php?t itle=hello%20wo rld">Hello World</a>
or
<a href="bla.php?t itle=hello+worl d">Hello World</a>

--
jmm dash list at sohnen-moe dot com
(Remove .TRSPAMTR for email)
Jul 20 '05 #5
James Moe wrote:
Philipp Lenssen wrote:
I know it's terribly incorrect (well I think I know) to use
something like
<a href="bla.php?t itle=hello world">Hello World</a>
but can I safely do this?

Because it's a URI, escape the space:
<a href="bla.php?t itle=hello%20wo rld">Hello World</a>
or
<a href="bla.php?t itle=hello+worl d">Hello World</a>


I know I know -- like I said, I'm using Blogger.com and I don't believe
they handle this! All I can do is say:

<a href="[title]">...</a>...

Something along the lines.

--
Google Blogoscoped
http://blog.outer-court.com
Jul 20 '05 #6
James Moe <jm************ ***@sohnen-moe.com> wrote:
Because it's a URI, escape the space:
<a href="bla.php?t itle=hello%20wo rld">Hello World</a>
That's the correct URL encoded form.
or
<a href="bla.php?t itle=hello+worl d">Hello World</a>


That's not. You are confusing form data encoding with URL encoding.
When form data is encoded using the default encoding, a space _must_ be
replaced by the "+" character, and after that URL encoding is applied.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7
Philipp Lenssen wrote:

Because it's a URI, escape the space:
<a href="bla.php?t itle=hello%20wo rld">Hello World</a>


I know I know -- like I said, I'm using Blogger.com and I don't believe
they handle this!

Hm. That seems very un-standard of them. Have you tried it?

--
jmm dash list at sohnen-moe dot com
(Remove .TRSPAMTR for email)
Jul 20 '05 #8
Jukka K. Korpela wrote:
James Moe <jm************ ***@sohnen-moe.com> wrote:
Because it's a URI, escape the space:
<a href="bla.php?t itle=hello%20wo rld">Hello World</a>
That's the correct URL encoded form.


Right.

The preferred term in ur*@w3.org for such "escaping", or
"encoding", is now "percent-encoding", present in both the latest
IRI and URI drafts. Dehyphenate at your peril! ;o)
or
<a href="bla.php?t itle=hello+worl d">Hello World</a>


That's not.


Right.
You are confusing form data encoding with URL encoding.


Maybe. If so, I think it's understandable.

Going back to RFC1630 (informational) , we see that "the plus sign
is reserved as shorthand notation for a space", in order "to make
query URIs easier to pass in systems which did not allow spaces";
but later, in RFC1738 (proposed standard), the same year, the
plus sign was removed from the set of reserved characters,
leaving it with no special significance. Now, however, RFC2396
has put the plus sign back into the query component's set of
reserved characters. Since RFC2396 updates the generic
definitions in RFC1738, the plus sign is currently reserved in
query components.

Is there anything wrong with <A href="?foo+bar" >baz</A>? ISTM
the plus sign has its reserved "meaning" or "purpose" of a space.
It doesn't violate HTML or URI rules. Do some applications
interpret <A href="?foo%20ba r">baz</A> differently?

Have a good weekend!

[ ... ]

--
Jock
Jul 20 '05 #9
John Dunlop <us*********@jo hn.dunlop.name> wrote:
Jukka K. Korpela wrote:
James Moe <jm************ ***@sohnen-moe.com> wrote:
> Because it's a URI, escape the space: <a
> href="bla.php?t itle=hello%20wo rld">Hello World</a>
That's the correct URL encoded form.


Right.

The preferred term in ur*@w3.org for such "escaping", or
"encoding", is now "percent-encoding", present in both the latest
IRI and URI drafts. Dehyphenate at your peril! ;o)


I usually don't bother too much using officialese, when the official
names are obscure, absurd, confusing, misleading, or just foolish, as
they often are. In this case, I don't bother at all, since "URL encoding"
is the term used in specifications, so the drafs need to achieve at least
RFC status before I let them confuse my language.
Going back to RFC1630 (informational) , we see that "the plus sign
is reserved as shorthand notation for a space", in order "to make
query URIs easier to pass in systems which did not allow spaces";
That adhockery may have been associated with the way the <isindex>
element was defined, and still is. For input via that antique element,
browsers are required to map spaces to plus signs, presumably because it
was thought that this makes URLs more readable to human beings.
Since RFC2396 updates the generic
definitions in RFC1738, the plus sign is currently reserved in
query components.
But being reserved does not mean much; clause 2.2 in RFC 2396 says:
"Characters in the reserved set are not reserved in all contexts. The set
of characters actually reserved within any given URI component is defined
by that component. In general, a character is reserved if the semantics
of the URI changes if the character is replaced with its escaped US-ASCII
encoding."
The plus sign is declared reserved in a query component. So what?
This means that the semantics of a URL changes if a "+" sign in a query
part is replace by its URL encoded equivalent %2B. Programs that process
URLs, such as form handlers, may still treat them the same way if they
like.
Is there anything wrong with <A href="?foo+bar" >baz</A>?
No, of course not. But the string after the "?" is just the query part,
to be handled by whichever program gets at it, the way it likes.
ISTM
the plus sign has its reserved "meaning" or "purpose" of a space.
No, it has no specific meaning or purpose defined in URL specifications.
It doesn't violate HTML or URI rules. Do some applications
interpret <A href="?foo%20ba r">baz</A> differently?


Surely. There's no requirement that an application accept both and treat
them similarly. If you write a form handler, you can happily reject both,
since they cannot originate in an HTML form submission (without
interference). If you write an <isindex> handler, you are required to
accept the former but may well treat the latter an error, since it cannot
result from the use of <isindex> input.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #10

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

Similar topics

3
8010
by: Hal Vaughan | last post by:
I need to be able to run external commands from within a Java program, on Linux and Windows (and eventually OSX). Under most circumstances there is no problem, but if the path I specify as part of the command has any spaces in it, or an argument for the command is a path with a space in it, or if I redirect the output to a file with a space in the filename, it doesn't work on Linux. I tried putting the paths in both single and double...
2
6945
by: HP | last post by:
I am using urllib.urlretrieve() to download a file from a web site. THe trouble is that the file name has spaces in it, such as "string string1 foo.doc". The statement: urllib.urlretrieve("http://website.com/path/string string1 foo.doc", "local_file"); produces local_file which contains the following one line: <html><head><title>Error</title></head><body>The parameter is
4
2548
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I want all of the spaces to be put in the first slots of the array. IE 6 does this. But Firefox 0.9.1 doesn't, and I don't know why. I have not been able to reproduce it in very simple form (which is itself a puzzle). But example code is...
7
9514
by: Tom | last post by:
I'm having a problem using a path with spaces as a parameter to os.rename() in a program on WinXP. This works fine at the command line (where the folder "c:\aa bb" exists) > os.rename( "c\aa bb", "c:\cc dd" ); > But, I can't get it to work in my program, eg.
3
8126
by: whatduck | last post by:
I'm having trouble passing a variable that contains spaces. If the variable contains a space I get the following error: "Application uses a value of the wrong type for the current operation." If I pass a variable with out any spaces the procedure executes without error. I have a procedure on SQL Server 2000 with the following variable: Create Procedure Zproc_Demand_Matrix
5
22942
by: Christine | last post by:
I have a text file that appears to be delimited by multiple spaces. The split function will only work with one space if I am correct. Is there some way to split this file into an array without getting the extra spaces?
3
11833
by: Mr Utkal Ranjan | last post by:
Hi Friends I want to launch notepad with a specific file on a command click event. So I was using the "Shell" function from VB on a command click event.For ex: Shell "Notepad.exe C:\Program Files\Test.txt",VbNormalFocus But here is the problem in the space of the "Program
135
7534
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about which is better. It has become what's known as “religious war” — a heated fight over trivia. In this essay, i like to explain what is the situation behind it, and which is proper.
4
4618
by: colleen1980 | last post by:
I try to remove the spaces with that method but it still dont work. When i run in the debug mode it still shows spaces. If (bCorpFound) Then strCorp = LTrim(strCorp) strCorp = RTrim(strCorp) strCorp = Replace(strCorp, " ", "") ' strCurrentChar = Right(strCorp, 1) ' Do While (strCurrentChar = " ") ' Advance 1 char, from right
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.