[ckan-dev] Create resource with french accents

Adrià Mercader adria.mercader at okfn.org
Tue Oct 20 16:33:36 UTC 2015


It does look like a bug, I've created an issue:

https://github.com/ckan/ckan/issues/2695

On 16 October 2015 at 13:59, Nicolas Brisebois-Tétreault <
nicolas.brisebois-tetreault at msp.gouv.qc.ca> wrote:

> Hi,
>
> I think you have to encode your special character in unicode. é would
> become \u00E9
>
> Some resourses :
> http://unicode-table.com/
>
> https://docs.python.org/2/howto/unicode.html#unicode-literals-in-python-source-code
>
>
> Le 2015-10-16 04:24, Dan Mihaila a écrit :
>
> Hello,
> I am trying to create a resource with filename containg french accents via
> API. The resource is created, but the file is not uploaded. I reproduced
> the same behaviour local and I couldn't find a solution.
> For example, I used http://master.ckan.org/dataset/asdgadsgadsgas and you
> can see that the resource is created:
> <http://master.ckan.org/dataset/asdgadsgadsgas/resource/4d8f2f38-07a9-479d-a557-880ace834016>
> http://master.ckan.org/dataset/asdgadsgadsgas/resource/4d8f2f38-07a9-479d-a557-880ace834016
> but when trying to download I am getting a 404 error:
> <http://master.ckan.org/dataset/8da7d905-2c3f-4faa-89b1-3635a9d06e73/resource/4d8f2f38-07a9-479d-a557-880ace834016/download/testfrenchaccentseies.zip>
> http://master.ckan.org/dataset/8da7d905-2c3f-4faa-89b1-3635a9d06e73/resource/4d8f2f38-07a9-479d-a557-880ace834016/download/testfrenchaccentseies.zip
>
> The script I am trying to run is a simple one:
>
> # coding=UTF-8
> # -*- coding: utf-8 -*-
> import requests
> import os
> url = 'http://master.ckan.org/api/3/action/resource_create'
> api_key = '27eb9769-eef3-4267-aaf1-be7038194732'
>
> h_dict={'X-CKAN-API-Key': api_key}
>
> data_dict = {}
> #other settings for resource
> data_dict['name'] = u'Test_french_accents_éiés.zip'
> data_dict['url'] = data_dict['name']
> path = u'/mypath/Test_french_accents_éiés.zip'
>
> resource_file = os.path.join(path)
> files = {'upload': open(resource_file, 'rb')}
> r = requests.post(url, data=data_dict, headers=h_dict, files=files,
> verify=False)
>
> What should I do to be able to make it work? :)
>
> Thanks,
>
> *Dan Mihaila*, IT Consultant
> (M) +40 722 502 304 • (GTalk) <dan.mihaila at gmail.com>dan.mihaila at gmail.com> (Skype) carcotelul
> • (Twitter) dan_mihaila • (Yahoo) carcotelul
>   <dmihaila at dginternational.org>
>
>
> _______________________________________________
> ckan-dev mailing listckan-dev at lists.okfn.orghttps://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
> --
> --------------------------------------------------------------------------
> Nicolas Brisebois-Tétreault
> Service de l'infrastructure et du réseau
> Direction des technologies de l'information
> Ministère de la Sécurité publique
> 2525 boul. Laurier, 2e étage
> Tour des Laurentides
> Québec
> G1V 2L2
> 418-646-6777 poste 30112
> nicolas.brisebois-tetreault at msp.gouv.qc.ca
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20151020/9bca59e5/attachment-0003.html>


More information about the ckan-dev mailing list