문제

i'm using URLCodec from Apache Commons Codec to encode URL, but it encode space as + NOT as %20

why? and what is the solution?

도움이 되었습니까?

해결책

See this related question

Of course, you can always do url.replace("+", "%20"); if you need it (after encoding)

다른 팁

Because + is an equally valid way of encoding a space. What are you trying to "solve"?

The URLCodec encodes stuff suitable a submitted form, which is not the same as percent encoding a URL. There's more explanation in this question

See this question for how you should encode your URL.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top