mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix decode
This commit is contained in:
parent
f66b5fe55e
commit
55ca246d3c
@ -134,6 +134,11 @@ public class URLDecoder implements Serializable {
|
|||||||
char c;
|
char c;
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
c = str.charAt(i);
|
c = str.charAt(i);
|
||||||
|
if(CharUtil.PLUS == c){
|
||||||
|
result.append(isPlusToSpace ? CharUtil.SPACE : c);
|
||||||
|
begin++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(ESCAPE_CHAR == c || CharUtil.isHexChar(c)){
|
if(ESCAPE_CHAR == c || CharUtil.isHexChar(c)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,12 @@ public class UrlDecoderTest {
|
|||||||
Assertions.assertEquals("+", URLDecoder.decodeForPath("+", CharsetUtil.UTF_8));
|
Assertions.assertEquals("+", URLDecoder.decodeForPath("+", CharsetUtil.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void decodePlusTest() {
|
||||||
|
final String decode = URLDecoder.decode("+", CharsetUtil.UTF_8);
|
||||||
|
Assertions.assertEquals(" ", decode);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void issue3063Test() throws UnsupportedEncodingException {
|
void issue3063Test() throws UnsupportedEncodingException {
|
||||||
// https://github.com/dromara/hutool/issues/3063
|
// https://github.com/dromara/hutool/issues/3063
|
||||||
|
Loading…
x
Reference in New Issue
Block a user