package com.hdl.photovoltaic.utils; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; /** * 编码加码 */ public class URLEncodingUtils { public static String encodeURIComponent(String value) { try { return URLEncoder.encode(value, "UTF-8") .replace("+", "%20") .replace("*", "%2A") .replace("%7E", "~"); } catch (Exception e) { return ""; } } }