Page MenuHomePhabricator

Wikidata Query Service does not properly quote Wikipedia sitelink URLs with commas when outputting in CSV format
Closed, DuplicatePublic

Description

When I run the following curl command against WDQS to retrieve a Wikipedia sitelink URL in CSV format, I get the Wikipedia URL. However the CSV format is wrong because the URL should be quoted due to the comma inside the URL.

curl -d "query=SELECT%20%3Furl%20WHERE%7Bwd%3AQ54860599%20wdt%3AP547%20%3Fcom.%3Furl%20schema%3Aabout%20%3Fcom%3Bschema%3AisPartOf%3Chttps%3A//en.wikipedia.org/%3E%7D" -X POST -H "Accept: text/csv" https://query.wikidata.org/sparql

The output of the curl command is the following:

url
https://en.wikipedia.org/wiki/San_Miguel_Arcangel_Church_(San_Miguel,_Bulacan)

But I am expecting the following (URL in quotes):

url
"https://en.wikipedia.org/wiki/San_Miguel_Arcangel_Church_(San_Miguel,_Bulacan)"

As far as I can tell, all other types of data such as Wikidata labels and monolingual text values are properly quoted.