chengkun
2025-09-19 d48eff069585e2be1bd02b1299e1fe7581cb6dad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package com.alipay.easysdk.kms.aliyun.credentials.utils;
 
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
 
public class AcsURLEncoder {
    public final static String URL_ENCODING = "UTF-8";
 
    public static String encode(String value) throws UnsupportedEncodingException {
        return URLEncoder.encode(value, URL_ENCODING);
    }
 
    public static String percentEncode(String value) throws UnsupportedEncodingException {
        return value != null ? URLEncoder.encode(value, URL_ENCODING).replace("+", "%20")
                .replace("*", "%2A").replace("%7E", "~") : null;
    }
}