"hstang" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> Does that mean there's no way to load images with file names that contains
> spaces then?  I'm not understanding something here.  Because if i include 
> a
> link to a graphic image whose filename contains spaces, it uses +, and
> tomcat refuses to the load image; however if I replace it with %20, then 
> it
> works.  How could this be?
>

Because, as Lucas has stated below, the '+' character only translates to ' ' 
when it is part of the query-string.  The only valid way to get a ' ' 
encoded before the query-string is to use %20.  Which is why you should save 
a lot of hair-pulling, and only allow filenames without spaces :).

>
> Lucas Galfaso wrote:
>>
>> Short answer:
>>   An URL has many part, one part that is called "path" (in this case
>> "upload/a b.jpg") and another part is called "query" (that is usually
>> what is after the "?" in a URL) These two parts use slightly different
>> reserved characters that may, should, or must be escaped under
>> different rules. To use "+" as a space is correct within the query,
>> but is correct within the path.
>>
>> Long answer:
>> http://www.ietf.org/rfc/rfc2396.txt
>> 2.2. Reserved Characters
>> 2.3. Unreserved Characters
>> 2.4. Escape Sequences
>> 3.3. Path Component
>> 3.4. Query Component
>>
>> Regards,
>>   LG
>>
>> On 6/6/07, hstang <[EMAIL PROTECTED]> wrote:
>>>
>>> I am currently having problems loading an image in Tomcat 6.13.  I have 
>>> a
>>> file "a b.jpg" in upload folder and I want to have a link to go to it.
>>>
>>> (1)  upload/a+b.jpg Here
>>> (2)  upload/a%20b.jpg Here
>>>
>>> Why does (2) work and not (1)?  Both '+' and "%20" represents spaces so
>>> there's no reason why they can't work. The Java URLEncoder.encode() will
>>> output (1), and my current framework of choice also output (1) but I
>>> can't
>>> seem to come out with (1).  What libraries can you use to force (2) out?
>>> What's the problem?
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Encoding-issue%3A-%2B-versus--20-tf3879033.html#a10992518
>>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/Encoding-issue%3A-%2B-versus--20-tf3879033.html#a10999556
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to