Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个简单的
String abc = "réunion";
我应该将此字符串转换为 URL 百分比编码 - 所以我需要:
String abc = "r%c3%a9union";
有什么简单的解决方案吗?
试试这个类:
java.net.URLEncoder
例如,对于编码为 UTF:
import java.net.URLEncoder; ..... String utf_encoded = URLEncoder.encode(url.toString(),"UTF-8");
URLEncoder.encode("réunion", "UTF-8")