Dear all,
I have a question. I have files with Greek (UTF-8) characters in their
names. I found that when I use API to upload files the saved file name
became very strange, and very far from the original name.
Here is the API call I use:
curl -H X-Dataverse-key:$API_KEY \
-X POST \
-F "file=@$ΜΕΡΟΣ.txt" \
-F 'jsonData={...}' \
"$SERVER_URL/api/datasets/:persistentId/add?persistentId=$PERSISTENT_IDENTIFIER"
the result is:
{
"status":"OK",
"data":{
"files":[
{
"label":"1ο Î^|Î^uΡÎ^=Σ.txt",
...
"dataFile":{
"filename":"1ο Î^|Î^uΡÎ^=Σ.txt",
...
}
}
]
}
}
I tried to make it explicit that our data are in UTF-8, but it failed:
curl -H X-Dataverse-key:$API_KEY \
-H "Content-Type: multipart/form-data; charset=UTF-8" \
-X POST \
-F "file=@$ΜΕΡΟΣ.txt" \
-F 'jsonData={...}' \
"$SERVER_URL/api/datasets/:persistentId/add?persistentId=$PERSISTENT_IDENTIFIER"
{
"status":"ERROR",
"code":400,
"message":"Bad Request. The API request cannot be completed with the
parameters supplied. Please check your code for typos, or consult our
API guide at
http://guides.dataverse.org.",
"requestUrl":"https://..../api/v1/datasets/:persistentId/add?persistentId=doi:10....",
"requestMethod":"POST"
}
Do you have any suggestions to solve the problem?
Best,
Péter Király
--
Péter Király
software developer
GWDG, Göttingen - Europeana - eXtensible Catalog - The Code4Lib Journal
http://linkedin.com/in/peterkiraly