开发者

in java my file paths with included spaces show up as %20 and i'm not sure why

I have a photo sel开发者_如何学JAVAection model, but for some reason whenever I call the path of the images, the space in the path is converted to it's HTML code and I'm not sure why. Do any of you have any ideas? Thanks for any help you can spare.


It's url encoded. I dont know the java library to un-encode but I'm sure it's out there and fairly easy to use.

edit - http://download.oracle.com/javase/1.4.2/docs/api/java/net/URLDecoder.html

this maybe?


The specification for URLs (RFC 1738, Dec. '94) says:

Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

And we have:

  1. Space = decimal code point 32 in the ISO-Latin set.
  2. 32 decimal = 20 in hexadecimal
  3. The URL encoded representation will be "%20"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜