// URL-Encoder armouring import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; ... String toSend = "The \"quick\" brown\nfox."; // encoding a String String send = URLEncoder.encode( toSend, "UTF-8" ); // decoding the String String reconstituted = URLDecoder.decode( received, "UTF-8" );