Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: markspace Newsgroups: comp.lang.java.programmer Subject: Re: URLEncoder and # Date: Fri, 20 Jun 2014 08:22:12 -0700 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 20 Jun 2014 15:22:14 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="9358cda03e1e0dfd3c4b757daa608707"; logging-data="10882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dxZU2ZZbcBYRq2XXEZ7vGtgoy1Qj5pFU=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Cancel-Lock: sha1:L0cEZf2X5ulaJ4bya75DE/GNZvE= Xref: csiph.com comp.lang.java.programmer:28797 On 6/20/2014 8:06 AM, Roedy Green wrote: > On Wed, 18 Jun 2014 11:30:23 +0100, Nigel Wade > 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.