org.javaswift.joss.util.SpaceURLEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joss Show documentation
Show all versions of joss Show documentation
Java Client library for OpenStack Storage (Swift)
package org.javaswift.joss.util;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
/**
* The purpose of this class is to supplement URLEncode.encode with the option to convert
* '+' into %20.
* See also:
* http://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character
* @author Robert Bor
*/
public class SpaceURLEncoder {
public static String encode(String value) throws UnsupportedEncodingException {
return URLEncoder.encode(value, "UTF-8").replace("+", "%20");
}
}