code: public String urlEncode(String original)
    {
      // see http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars
      // for an explanation of the character encoding
      String s = null;
      try
      {
        s = URLEncoder.encode(original, _characterEncoding);
      }
      catch(UnsupportedEncodingException e)
      {
        throw new RuntimeException(e);
      }
  
      if(_encodeDot)
      {
        // we encode . as well because it can cause problems in url in emails.
        s = TextUtils.searchAndReplace(s, ".", "%2E");
      }
  
      return s;
    }
docs: Encapsulates the call to encoding a URL
  
  @param original the string to encode
  @return the encoded url