EncodeUtils.encodeUrl 忽略字符编码传递空值,默认 UTF-8
This commit is contained in:
@@ -154,7 +154,7 @@ public class EncodeUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return URLEncoder.encode(part, encoding);
|
return URLEncoder.encode(part, StringUtils.isNotBlank(encoding) ? encoding : EncodeUtils.UTF_8);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw ExceptionUtils.unchecked(e);
|
throw ExceptionUtils.unchecked(e);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ public class EncodeUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return URLDecoder.decode(part, encoding);
|
return URLDecoder.decode(part, StringUtils.isNotBlank(encoding) ? encoding : EncodeUtils.UTF_8);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
throw ExceptionUtils.unchecked(e);
|
throw ExceptionUtils.unchecked(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user