Use URL encoder:
String encodedURL = "www.example.com/ClassName/Methodname/254/" + URLEncoder.encode("Any text in any language", "utf-8");
UTF-8 of course is the encoding to use.
You can read more here: https://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html