[ 
https://issues.apache.org/jira/browse/JENA-2255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17477352#comment-17477352
 ] 

Andy Seaborne commented on JENA-2255:
-------------------------------------

Please provide a Minimal Complete Example.

What system is the remote endpoint?

SPARQL update strings are defined for UTF-8 only. Theer is no need to specify 
the charset.

If the endpoint isn't honouring that, it's a bug but make sure the 
updateRequest string is legal UTF-8 (e.g. if it is read from a file on Windows, 
it may not be)

You can test the endpoint with {{curl}} and check that setting the Content-Type 
header does, in fact, make a difference.

> Setting content type in Jena RDFConnection Header ?
> ---------------------------------------------------
>
>                 Key: JENA-2255
>                 URL: https://issues.apache.org/jira/browse/JENA-2255
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Jena
>            Reporter: Mohamed BEN ELLEFI
>            Priority: Major
>
> Hello,
> I need to modify the header (specifically the Content-Type) of a request (eg: 
> update) of an RDFConnection object in a Jena transaction. More precisely, I 
> need to add the following Header Content_Type {{Content-Type = 
> [application/sparql-query; charset=UTF-8]}}
> in the following code
> {code:java}
> try (RDFConnection conn = connectionFactory.create()) { 
> Txn.executeWrite(conn, () -> { 
> conn.update(updateRequest);// HERE we want to setup the Content-Type in the 
> header 
> }); 
> }catch (Exception e) {... }{code}
>  
> I have setup the connectionFactory as follow
> {code:java}
> public RDFConnection create() {
> HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
> HttpClient httpClient = 
> httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider)
> .build();
> return
> RDFConnectionRemote.create()
> .destination(endpointURL)
> .queryEndpoint("query")
> .updateEndpoint("update")
> .httpClient(httpClient)
> .parseCheckSPARQL(true)
> .build();
> }{code}
> So, I still need to specify the charset of the request body in the the 
> request header content-Type . How can I do that with JENA ?
> Note: the default JENA RDFConnection setting is not sufficient because the 
> remote endpoint still needs the explicit specification of the charset to 
> parse my SPARQL requests containing French accents in the URIs.
> Thanks in advance
> stackoverflow : 
> [https://stackoverflow.com/questions/70742161/setting-content-type-in-jena-rdfconnection-header|http://example.com/]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to