The detailsString is encoded (as it is part of the URI constructor). This actually is the main part that needs encoding. The URI constructor requires a try/catch block is it can throw unknown encoding exception.But in our case the catch block should just never be reached as we hardcode the encoding  to be an always valid UTF-8.  

 
On Feb 18, 2014, at 12:28 AM, thobach <notifications@github.com> wrote:

> In src/com/mambu/apisdk/util/URLHelper.java:
> 
> >  	 */
> >  	public String createUrl(String details) {
> >  		details = details == null ? "" : details;
> > -		return WEB_PROTOCOL + "://" + domainName + "/api/" + details;
> > +
> > +		// URL String must be url-encoded to handle spaces and UTF-8 chars (See MBU-4669, implemented in Mambu 3.4)
> > +		String encodedUrl;
> > +		try {
> > +			URI uri = new URI(WEB_PROTOCOL, domainName, API_ENDPOINT + details, null);
> > +			encodedUrl = uri.toString();
> > +
> > +		} catch (URISyntaxException e) {
> > +
> > +			encodedUrl = WEB_PROTOCOL + "://" + domainName + API_ENDPOINT + details;
> Why is this fall back needed and should then the details variable be URL encoded as well?
> 
> —
> Reply to this email directly or view it on GitHub.
>