URLEncoder is the way to go. You only need to keep in mind to encode only the individual query string parameter name and/or value, not the entire URL, ... ... <看更多>
import java.net.URLEncoder;. import java.util.ArrayList;. import java.util.List;. /**. * A class to create URL parameters in a builder-like fashion. ... <看更多>
As another example, this code prints the human-readable query parameters of a Twitter search: ... These two URLs are semantically identical, but java.net. ... <看更多>