java.net.URLEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-js-jre Show documentation
Show all versions of dragome-js-jre Show documentation
Dragome SDK module: js-jre
package java.net;
import com.dragome.commons.javascript.ScriptHelper;
/**
* Utility class for HTML form encoding.
*
*
*/
public class URLEncoder
{
/**
* Translates a string into application/x-www-form-urlencoded format using a specific encoding scheme.
* @param enc must be 'UTF-8'
*/
public static String encode(String s, String enc)
{ // TODO: throws UnsupportedEncodingException
//s = s.replaceAll(" ", "+");
ScriptHelper.put("s", s, null);
s= (String) ScriptHelper.eval("encodeURIComponent(s)", null);
return s;
}
}