Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: Android: create drawable from path Date: Thu, 05 May 2011 09:39:32 +0100 Lines: 47 Message-ID: <92f625F2n3U1@mid.individual.net> References: <90opnjFunsU1@mid.individual.net> <908b85be-4c87-4bd6-b5f1-4b82ffeea13e@b13g2000prf.googlegroups.com> <90p3v4Fe4fU1@mid.individual.net> <90pfmdF17bU1@mid.individual.net> <99mdnexwGbGIDDrQnZ2dnUVZ_h6dnZ2d@earthlink.com> <90pkrcF1aaU1@mid.individual.net> <90qlgfFt2vU1@mid.individual.net> <92dgnmF3ciU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 75e573YnwUD3TCEbOlq7QQcZ0soxJbz4fF/C5F60GM25dJ8Jrx Cancel-Lock: sha1:vWujqeAE6jWR91zedNr34bDKcC4= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 In-Reply-To: <92dgnmF3ciU1@mid.individual.net> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3547 On 04/05/11 18:29, Dirk Bruere at NeoPax wrote: > Any suggestions as to why this url causes an exception (I assume its > illegal characters or something) > > http://192.168.0.6:8081/video/clip_art/pan's.labyrinth[2006]dvdrip[eng.sub]-axxo+new.+swesub.+prien.avi.jpg > > > and this does not > http://192.168.0.6:8081/Audio/Album+Art/P-T/Therion_Sirius+B.jpg > > when used here: > > InputStream content = (InputStream) url.getContent(); > It should be encoded with java.net.URLEncoder. There are characters in that string which are not "safe" within a URL. From RFC 1738: > Unsafe: > > Characters can be unsafe for a number of reasons. The space > character is unsafe because significant spaces may disappear and > insignificant spaces may be introduced when URLs are transcribed or > typeset or subjected to the treatment of word-processing programs. > The characters "<" and ">" are unsafe because they are used as the > delimiters around URLs in free text; the quote mark (""") is used to > delimit URLs in some systems. The character "#" is unsafe and should > always be encoded because it is used in World Wide Web and in other > systems to delimit a URL from a fragment/anchor identifier that might > follow it. The character "%" is unsafe because it is used for > encodings of other characters. Other characters are unsafe because > gateways and other transport agents are known to sometimes modify > such characters. These characters are "{", "}", "|", "\", "^", "~", > "[", "]", and "`". > > All unsafe characters must always be encoded within a URL. For > example, the character "#" must be encoded within URLs even in > systems that do not normally deal with fragment or anchor > identifiers, so that if the URL is copied into another system that > does use them, it will not be necessary to change the URL encoding. > > -- Nigel Wade