A working solution , if the encoding is UTF-8 , just use
Document document = Jsoup.connect("http://www.example.com") .data("q", "Türkçe") .get();
with the result
URL=http://www.example.com?q=T%C3%BCrk%C3%A7e
For custom encoding, this can be used:
String encodedUrl = URLEncoder.encode("http://www.example.com/q=Türkçe", "ISO-8859-3"); String encodedBaseUrl = URLEncoder.encode("http://www.example.com/q=", "ISO-8859-3"); String query = encodedUrl.replace(encodedBaseUrl, ""); Document doc= Jsoup.connect("http://www.example.com") .data("q", query) .get();
source share