diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index f263e22c..db24b141 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -297,7 +297,7 @@ public abstract class AbsFileer strs = new HashSet<>(); + while (m.find()) { + strs.add(m.group()); + } + try { + for (String str : strs) { + url = url.replaceAll(str, URLEncoder.encode(str, "UTF-8")); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + return url; + } + + /** + * 判断是否有双字节字符(包括汉字在内) + * + * @param chineseStr 需要进行判断的字符串 + * @return {@code true}有双字节字符,{@code false} 无双字节字符 + */ + public static boolean hasDoubleCharacter(String chineseStr) { + char[] charArray = chineseStr.toCharArray(); + for (char aCharArray : charArray) { + if ((aCharArray >= 0x0391) && (aCharArray <= 0xFFE5)) { + return true; + } + } + return false; + } + /** * base64 解密字符串 * diff --git a/app/src/main/java/com/arialyy/simple/MainActivity.java b/app/src/main/java/com/arialyy/simple/MainActivity.java index 8a8a7cd6..dc0012a7 100644 --- a/app/src/main/java/com/arialyy/simple/MainActivity.java +++ b/app/src/main/java/com/arialyy/simple/MainActivity.java @@ -70,4 +70,5 @@ public class MainActivity extends BaseActivity { break; } } + }