Java —— UTF-8编码转换

问题

如何将字符串转换为UTF-8编码?

解决

String utfStr= java.net.URLEncoder.encode(待转换的字符串);