Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISQL CSV encoding is weird... #421

Open
joernhees opened this issue Jun 9, 2015 · 7 comments
Open

ISQL CSV encoding is weird... #421

joernhees opened this issue Jun 9, 2015 · 7 comments

Comments

@joernhees
Copy link

Is it just me or is the isql CSV encoding weird?

SQL> SET CSV=ON;
SQL> sparql select ?s ("hallo you; % jörn" as ?foo) ?p  where {?s ?p ?o} limit 1;
s;foo;p
http://www.openlinksw.com/virtrdf-data-formats#default-iid;hallo you%3B %25 j%FFF6rn;http://www.w3.org/1999/02/22-rdf-syntax-ns#type

1 Rows. -- 2 msec.

I guess that this is some kind of ASCII-%-URI-like-encoding, but it's not very parseable, especially the " % " being equal to "%3B %25 " and the "ö" being "%FFF6".

@roelj
Copy link

roelj commented Sep 3, 2020

Digging up an old issue..

I am wondering how the encoding actually works. I have a value in which a single ö is turned into %FFC3%FFB6.
The command I used is:

isql 1111 csv=on exec='SPARQL SELECT ?s ?o FROM <some-graph> WHERE { ?s rdfs:label ?o }'

Not using the csv=on produces the ö just fine:

isql 1111 exec='SPARQL SELECT ?s ?o FROM <some-graph> WHERE { ?s rdfs:label ?o }'

@HughWilliams
Copy link
Collaborator

HughWilliams commented Sep 3, 2020

The "isql" SET CSV_RFC4180 ON; command is the correct way to enable CSV results output:

SQL> SET CSV_RFC4180 ON;
SQL> SPARQL SELECT * WHERE {?s ?p ?o} LIMIT 2;
"s","p","o"
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"

2 Rows. -- 81 msec.
SQL>

@roelj
Copy link

roelj commented Sep 4, 2020

That doesn't seem to affect the encoding:

/opt/sparqling-genomics/bin/isql 1111 verbose=off csv_rfc4180=on csv_rfc4180_field_separator=, exec='SPARQL SELECT ?s ?o FROM <some-graph> WHERE { ?s rdfs:label ?o }'

Produces the same %FFC3%FFB6.

@HughWilliams
Copy link
Collaborator

We shall look into this encoding issue in "isql" ...

@roelj
Copy link

roelj commented Sep 4, 2020

Thanks a lot!

Perhaps an easy way to avoid breaking anything is to introduce a no_encode option in binsrc/tests/isql.c and use field_print_normal in field_print_csv_rfc4180 when no_encode is set to on.

If you'd like I could prepare a patch that implements this.

@HughWilliams
Copy link
Collaborator

@roelj: patch contributions are always welcomed ...

@roelj
Copy link

roelj commented Sep 8, 2020

Just letting you know that my initial idea does not seem to have any effect: roelj@4908939. So I'm working on a second version of the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants