【代码优化】增强 JDK17、JDK8 之间的兼容性
This commit is contained in:
@@ -190,7 +190,7 @@ public class AliyunSmsClient extends AbstractSmsClient {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
private static String percentCode(String str) {
|
private static String percentCode(String str) {
|
||||||
Assert.notNull(str, "str 不能为空");
|
Assert.notNull(str, "str 不能为空");
|
||||||
return URLEncoder.encode(str, StandardCharsets.UTF_8)
|
return HttpUtils.encodeUtf8(str)
|
||||||
.replace("+", "%20") // 加号 "+" 被替换为 "%20"
|
.replace("+", "%20") // 加号 "+" 被替换为 "%20"
|
||||||
.replace("*", "%2A") // 星号 "*" 被替换为 "%2A"
|
.replace("*", "%2A") // 星号 "*" 被替换为 "%2A"
|
||||||
.replace("%7E", "~"); // 波浪号 "%7E" 被替换为 "~"
|
.replace("%7E", "~"); // 波浪号 "%7E" 被替换为 "~"
|
||||||
|
|||||||
Reference in New Issue
Block a user