Spaces in parameter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philipp Lenssen

    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
    A daily news blog and community covering Google, search, and technology.

  • Harlan Messinger

    #2
    Re: Spaces in parameter


    "Philipp Lenssen" <info@outer-court.com> wrote in message
    news:2jdt18Fvt4 4uU1@uni-berlin.de...[color=blue]
    > 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.[/color]
    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.
    [color=blue]
    > I'm sure above will work in IExplorer as does many broken HTML.[/color]

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

    Comment

    • John Dunlop

      #3
      Re: Spaces in parameter

      Philipp Lenssen wrote:
      [color=blue]
      > 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>[/color]

      It's incorrect insofar as it's a violation of the spec.
      [color=blue]
      > but can I safely do this?[/color]

      Dunno.

      --
      Jock

      Comment

      • Stanimir Stamenkov

        #4
        Re: Spaces in parameter

        /Philipp Lenssen/:
        [color=blue]
        > 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?[/color]

        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

        Comment

        • James Moe

          #5
          Re: Spaces in parameter

          Philipp Lenssen wrote:[color=blue]
          > 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?
          >[/color]
          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)

          Comment

          • Philipp Lenssen

            #6
            Re: Spaces in parameter

            James Moe wrote:
            [color=blue]
            > Philipp Lenssen wrote:[color=green]
            > > 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?
            > >[/color]
            > 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>[/color]

            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
            A daily news blog and community covering Google, search, and technology.

            Comment

            • Jukka K. Korpela

              #7
              Re: Spaces in parameter

              James Moe <jmm-list.TRSPAMTR@s ohnen-moe.com> wrote:
              [color=blue]
              > Because it's a URI, escape the space:
              > <a href="bla.php?t itle=hello%20wo rld">Hello World</a>[/color]

              That's the correct URL encoded form.
              [color=blue]
              > or
              > <a href="bla.php?t itle=hello+worl d">Hello World</a>[/color]

              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

              Comment

              • James Moe

                #8
                Re: Spaces in parameter

                Philipp Lenssen wrote:[color=blue][color=green]
                >>
                >>Because it's a URI, escape the space:
                >><a href="bla.php?t itle=hello%20wo rld">Hello World</a>[/color]
                >
                > I know I know -- like I said, I'm using Blogger.com and I don't believe
                > they handle this!
                >[/color]
                Hm. That seems very un-standard of them. Have you tried it?

                --
                jmm dash list at sohnen-moe dot com
                (Remove .TRSPAMTR for email)

                Comment

                • John Dunlop

                  #9
                  Re: Spaces in parameter

                  Jukka K. Korpela wrote:
                  [color=blue]
                  > James Moe <jmm-list.TRSPAMTR@s ohnen-moe.com> wrote:
                  >[color=green]
                  > > Because it's a URI, escape the space:
                  > > <a href="bla.php?t itle=hello%20wo rld">Hello World</a>[/color]
                  >
                  > That's the correct URL encoded form.[/color]

                  Right.

                  The preferred term in uri@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)
                  [color=blue][color=green]
                  > > or
                  > > <a href="bla.php?t itle=hello+worl d">Hello World</a>[/color]
                  >
                  > That's not.[/color]

                  Right.
                  [color=blue]
                  > You are confusing form data encoding with URL encoding.[/color]

                  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

                  Comment

                  • Jukka K. Korpela

                    #10
                    Re: Spaces in parameter

                    John Dunlop <usenet+2004@jo hn.dunlop.name> wrote:
                    [color=blue]
                    > Jukka K. Korpela wrote:
                    >[color=green]
                    >> James Moe <jmm-list.TRSPAMTR@s ohnen-moe.com> wrote:
                    >>[color=darkred]
                    >> > Because it's a URI, escape the space: <a
                    >> > href="bla.php?t itle=hello%20wo rld">Hello World</a>[/color]
                    >>
                    >> That's the correct URL encoded form.[/color]
                    >
                    > Right.
                    >
                    > The preferred term in uri@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)[/color]

                    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.
                    [color=blue]
                    > 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";[/color]

                    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.
                    [color=blue]
                    > Since RFC2396 updates the generic
                    > definitions in RFC1738, the plus sign is currently reserved in
                    > query components.[/color]

                    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.
                    [color=blue]
                    > Is there anything wrong with <A href="?foo+bar" >baz</A>?[/color]

                    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.
                    [color=blue]
                    > ISTM
                    > the plus sign has its reserved "meaning" or "purpose" of a space.[/color]

                    No, it has no specific meaning or purpose defined in URL specifications.
                    [color=blue]
                    > It doesn't violate HTML or URI rules. Do some applications
                    > interpret <A href="?foo%20ba r">baz</A> differently?[/color]

                    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

                    Comment

                    • Philipp Lenssen

                      #11
                      Re: Spaces in parameter

                      James Moe wrote:
                      [color=blue]
                      > Philipp Lenssen wrote:[color=green][color=darkred]
                      > > >
                      > > > Because it's a URI, escape the space:
                      > > > <a href="bla.php?t itle=hello%20wo rld">Hello World</a>[/color]
                      > >
                      > > I know I know -- like I said, I'm using Blogger.com and I don't
                      > > believe they handle this!
                      > >[/color]
                      > Hm. That seems very un-standard of them. Have you tried it?[/color]

                      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
                      A daily news blog and community covering Google, search, and technology.

                      Comment

                      Working...