Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28767 > unrolled thread
| Started by | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| First post | 2014-06-18 02:37 -0700 |
| Last post | 2014-06-18 18:50 -0700 |
| Articles | 7 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
URLEncoder and # Roedy Green <see_website@mindprod.com.invalid> - 2014-06-18 02:37 -0700
Re: URLEncoder and # Nigel Wade <nmw@ion.le.ac.uk> - 2014-06-18 11:30 +0100
Re: URLEncoder and # Roedy Green <see_website@mindprod.com.invalid> - 2014-06-20 08:06 -0700
Re: URLEncoder and # markspace <markspace@nospam.nospam> - 2014-06-20 08:22 -0700
Re: URLEncoder and # Arne Vajhøj <arne@vajhoej.dk> - 2014-06-21 23:10 -0400
Re: URLEncoder and # Joerg Meier <joergmmeier@arcor.de> - 2014-06-18 16:42 +0200
Re: URLEncoder and # Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-06-18 18:50 -0700
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2014-06-18 02:37 -0700 |
| Subject | URLEncoder and # |
| Message-ID | <t8n2q9phsbha7e25j4tj0e53sqa3qqt0g0@4ax.com> |
It seems URLEncoder converts # to %23 Why would there be any need to encode it? The AppVisor people are complaining about URLs containing # saying they need to be URLEncoded. Surely that is not true. -- Roedy Green Canadian Mind Products http://mindprod.com Software gets slower faster than hardware gets faster. ~ Niklaus Wirth (born: 1934-02-15 age: 80) Wirth's Law
[toc] | [next] | [standalone]
| From | Nigel Wade <nmw@ion.le.ac.uk> |
|---|---|
| Date | 2014-06-18 11:30 +0100 |
| Message-ID | <c0d81vFpkskU1@mid.individual.net> |
| In reply to | #28767 |
On 18/06/14 10:37, Roedy Green wrote: > It seems URLEncoder converts # to %23 > > Why would there be any need to encode it? Because # is a special character in a URI. It separates the main URI from a fragment suffix. Have you never used "NAME" tag in your web pages to identify sub-sections? The browser shouldn't send anything after a # in a request, it's used by the browser to identify a fragment within the returned page. The URI specification should satisfy your curiosity. > > The AppVisor people are complaining about URLs containing # saying > they need to be URLEncoded. Surely that is not true. > I think it probably is true.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2014-06-20 08:06 -0700 |
| Message-ID | <ncj8q9lpkg6h39ob163a5bpk8i89o3n84m@4ax.com> |
| In reply to | #28769 |
On Wed, 18 Jun 2014 11:30:23 +0100, Nigel Wade <nmw@ion.le.ac.uk> wrote, quoted or indirectly quoted someone who said : >> >> The AppVisor people are complaining about URLs containing # saying >> they need to be URLEncoded. Surely that is not true. >> > >I think it probably is true. If wanted to include # in a file name you would encode it, but if you meant it to introduce an anchor on the page you would not, right? -- Roedy Green Canadian Mind Products http://mindprod.com Software gets slower faster than hardware gets faster. ~ Niklaus Wirth (born: 1934-02-15 age: 80) Wirth's Law
[toc] | [prev] | [next] | [standalone]
| From | markspace <markspace@nospam.nospam> |
|---|---|
| Date | 2014-06-20 08:22 -0700 |
| Message-ID | <lo1jj6$ak2$1@dont-email.me> |
| In reply to | #28792 |
On 6/20/2014 8:06 AM, Roedy Green wrote: > On Wed, 18 Jun 2014 11:30:23 +0100, Nigel Wade <nmw@ion.le.ac.uk> > wrote, quoted or indirectly quoted someone who said : > >>> >>> The AppVisor people are complaining about URLs containing # saying >>> they need to be URLEncoded. Surely that is not true. >>> >> >> I think it probably is true. > > If wanted to include # in a file name you would encode it, but if you > meant it to introduce an anchor on the page you would not, right? > If by "file name" you mean the path part of the URI, then yes. However watch out for including other special characters in the anchor: http://foo.com/path#my#1anchor Will confuse most parsers and is probably a syntax error anyway. Also watch out for the query part of the URI, which needs to be encoded differently. http://foo.com/path?a=#1,b=#2#anchor Is also incorrectly encoded.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2014-06-21 23:10 -0400 |
| Message-ID | <53a64941$0$293$14726298@news.sunsite.dk> |
| In reply to | #28797 |
On 6/20/2014 11:22 AM, markspace wrote: > On 6/20/2014 8:06 AM, Roedy Green wrote: >> On Wed, 18 Jun 2014 11:30:23 +0100, Nigel Wade <nmw@ion.le.ac.uk> >> wrote, quoted or indirectly quoted someone who said : >> >>>> >>>> The AppVisor people are complaining about URLs containing # saying >>>> they need to be URLEncoded. Surely that is not true. >>>> >>> >>> I think it probably is true. >> >> If wanted to include # in a file name you would encode it, but if you >> meant it to introduce an anchor on the page you would not, right? >> > > If by "file name" you mean the path part of the URI, then yes. However > watch out for including other special characters in the anchor: > > http://foo.com/path#my#1anchor > > Will confuse most parsers and is probably a syntax error anyway. Also > watch out for the query part of the URI, which needs to be encoded > differently. > > http://foo.com/path?a=#1,b=#2#anchor > > Is also incorrectly encoded. I think a lot of the confusion about this class comes from its name. Contrary to its name it is not used to encode URL's. It is documented. Java docs says: <quote> Utility class for HTML form encoding. This class contains static methods for converting a String to the application/x-www-form-urlencoded MIME format. For more information about HTML form encoding, consult the HTML specification. </quote> But just the name gives people the wrong associations. Arne
[toc] | [prev] | [next] | [standalone]
| From | Joerg Meier <joergmmeier@arcor.de> |
|---|---|
| Date | 2014-06-18 16:42 +0200 |
| Message-ID | <xiv3buqn5429.1d0rxsore4t96.dlg@40tude.net> |
| In reply to | #28767 |
On Wed, 18 Jun 2014 02:37:09 -0700, Roedy Green wrote: > It seems URLEncoder converts # to %23 > Why would there be any need to encode it? > The AppVisor people are complaining about URLs containing # saying > they need to be URLEncoded. Surely that is not true. This link explains it, and in a weird twist of fate, also actually contains the #: <http://en.wikipedia.org/wiki/HTML_element#Anchor> Liebe Gruesse, Joerg -- Ich lese meine Emails nicht, replies to Email bleiben also leider ungelesen.
[toc] | [prev] | [next] | [standalone]
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Date | 2014-06-18 18:50 -0700 |
| Message-ID | <mcmurtrie-088F16.18502018062014@news.sonic.net> |
| In reply to | #28767 |
In article <t8n2q9phsbha7e25j4tj0e53sqa3qqt0g0@4ax.com>, Roedy Green <see_website@mindprod.com.invalid> wrote: > It seems URLEncoder converts # to %23 > > Why would there be any need to encode it? > > The AppVisor people are complaining about URLs containing # saying > they need to be URLEncoded. Surely that is not true. Like '/', it has different meanings in different parts of the URL. There is no way to encode a simple string into a full URL. That's why there are tools to build URLs. Try finding a server that handles an encoded '/' in a path correctly. That incorrect handling breaks many kinds of REST APIs.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web