punycode中大写字母解码异常问题修复,统一编码和解码为小写

This commit is contained in:
zhaoxinhu 2023-05-31 09:28:13 +08:00
parent 80e5d09c22
commit 021419b8a2

View File

@ -36,6 +36,7 @@ public class PunyCode {
*/
public static String encodeDomain(String domain) throws UtilException {
Assert.notNull(domain, "domain must not be null!");
domain = domain.toLowerCase();
final List<String> split = StrUtil.split(domain, CharUtil.DOT);
final StringBuilder result = new StringBuilder(domain.length() * 4);
for (final String str : split) {
@ -156,6 +157,7 @@ public class PunyCode {
*/
public static String decodeDomain(String domain) throws UtilException {
Assert.notNull(domain, "domain must not be null!");
domain = domain.toLowerCase();
final List<String> split = StrUtil.split(domain, CharUtil.DOT);
final StringBuilder result = new StringBuilder(domain.length() / 4 + 1);
for (final String str : split) {