473,498 Members | 1,842 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?title=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 8622

"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?title=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?title=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?title=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?title=hello world">Hello World</a>
but can I safely do this?

Because it's a URI, escape the space:
<a href="bla.php?title=hello%20world">Hello World</a>
or
<a href="bla.php?title=hello+world">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?title=hello world">Hello World</a>
but can I safely do this?

Because it's a URI, escape the space:
<a href="bla.php?title=hello%20world">Hello World</a>
or
<a href="bla.php?title=hello+world">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?title=hello%20world">Hello World</a>
That's the correct URL encoded form.
or
<a href="bla.php?title=hello+world">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?title=hello%20world">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?title=hello%20world">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?title=hello+world">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%20bar">baz</A> differently?

Have a good weekend!

[ ... ]

--
Jock
Jul 20 '05 #9
John Dunlop <us*********@john.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?title=hello%20world">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%20bar">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
James Moe wrote:
Philipp Lenssen wrote:

Because it's a URI, escape the space:
<a href="bla.php?title=hello%20world">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?


Actually they don't really know what they are doing when they replace
values in a template. Yes, I've tried it too. I don't even excpect them
to handle this.

Maybe I should have just written my own blogging software but when I
started out I first wanted to get a feeling for what blogging means and
what the application must have.
I think more and more about writing it myself in PHP+MySQL with
XHTML1.0 Strict+CSS2 output. I don't like most blogging apps as they
take too long to load and need JavaScript to work. Besides, Blogger.com
needs to transfer all files to my FTP server everytime, and if I change
the template I need to republish the whole blog (which is slow).

Thanks for the answers...

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

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

Similar topics

3
7992
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...
2
6884
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:...
4
2517
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...
7
9385
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...
3
8066
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." ...
5
22923
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...
3
11805
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...
135
7338
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...
4
4592
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)...
0
7005
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
7168
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,...
0
7210
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...
1
6891
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...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3096
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...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
293
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...

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.