Hey,

I have some code that adds query parameters to SPARQL Protocol requests.

According to my quick research, the final HTTP query string depends on
com.hp.hpl.jena.sparql.engine.http.Params.httpString():

    public String httpString()
    {
        StringBuffer sbuff = new StringBuffer() ;
        boolean first = true ;
        for (Pair p : pairs())
        {
            if ( !first )
                sbuff.append('&') ;
            sbuff.append(p.getName()) ;
            sbuff.append('=') ;
            String x = p.getValue() ;
            x = Convert.encWWWForm(x) ;
            sbuff.append(x) ;
            first = false ;
        }
        return sbuff.toString() ;
    }

I see the parameter values being encoded, but not the names, for some
reason? Looks like a bug to me.

Also, the code depends on URLEncoder.encode(), which implements
"application/x-www-form-urlencoded", aka HTML form encoding.

To my understanding, this is different from the URI syntax spec:
https://tools.ietf.org/html/rfc3986

One of the differences is space encoded as "+" vs. "%20".

Am I right that the incorrect encoding is used here (and probably in
similar places)?


Martynas
graphityhq.com

Reply via email to