code: private String encode(String str) {
          if (str == null) {
              return null;
          }
          try {
              return URLEncoder.encode(str, Charsets.UTF_8.name());
          } catch (UnsupportedEncodingException e) {
              // Should never happen
              throw Throwables.propagate(e);
          }
      }
docs: URL encodes the given string.