URLEncoder.encode() and a whitespace?

后端 未结 3 1332
庸人自扰
庸人自扰 2021-01-22 14:43

I\'ve got a resource on my server named:

some image.png

There\'s a space in the name. When I type the url into the browser (chrome), it\'s tran

3条回答
  •  故里飘歌
    2021-01-22 14:46

    http://www.permadi.com/tutorial/urlEncoding/

    Note that because the character is very commonly used, a special code ( the "+" sign) has been reserved as its URL encoding. Thus the string "A B" can be URL encoded as either "A%20B" or "A+B"

    However, your code is probably failing because some parsers/web servers do not handle them equally for base URL portions - and only recognize + = space in the querystring portion

提交回复
热议问题