fix: StandardCharsets.UTF_8 替换为 Charset.forName("UTF-8")
Android 4.2(API 17)不支持 java.nio.charset.StandardCharsets(API 19+), 5 个文件统一改用兼容 API 1 的 String 重载: - DeviceIdentityProvider / HMacShaUtils / Md5Utils: Charset.forName - UrlParamBuilder: URLEncoder.encode(str, "UTF-8") - ContentDetailUtils: 删除未使用的 import
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package com.pukka.jiecheng.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class UrlParamBuilder {
|
||||
|
||||
@@ -60,9 +60,15 @@ public class UrlParamBuilder {
|
||||
urlBuilder.append("&");
|
||||
}
|
||||
|
||||
urlBuilder.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8))
|
||||
try {
|
||||
urlBuilder.append(URLEncoder.encode(entry.getKey(), "UTF-8"))
|
||||
.append("=")
|
||||
.append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8));
|
||||
.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
urlBuilder.append(entry.getKey())
|
||||
.append("=")
|
||||
.append(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user