[GeoNode-users] Encoding error on upload zipped shapefile on centos 7
sstein at geo.uzh.ch
Wed Jul 12 13:53:50 PDT 2017
perhaps not helpful, but would it not be easier to load the shape in
QGIS and save it as a new dataset with another encoding there?
On 07/12/2017 04:34 PM, Francesco Bartoli wrote:
> I'm facing a common error while uploading an archived shapefile. The
> file is the commonly used ne_50m_admin_0_countries.
> The error is well known also in django documentation and due to non
> ascii characters:
> Unfortunately the recommended solution from the django docs for
> deployments with apache and mod_wsgi
> doesn't solve the issue in centos 7. The box has been created while
> reviewing the installation on that environment as per this PR
> It can be easily reproduced by adding this view and route within
> geonode app:
> import locale
> import sys
> from django.http import HttpResponse
> def view_locale(request):
> loc_info = "getlocale: " + str(locale.getlocale()) + \
> "<br/>getdefaultlocale(): " + str(locale.getdefaultlocale()) + \
> "<br/>fs_encoding: " + str(sys.getfilesystemencoding()) + \
> "<br/>sys default encoding: " + str(sys.getdefaultencoding())
> return HttpResponse(loc_info)
> url(r'^locale/$', 'geonode.my_views.view_locale'),
> Result is always this:
> getlocale: (None, None)
> getdefaultlocale(): ('en_US', 'UTF-8')
> fs_encoding: UTF-8
> sys default encoding: ascii
> Setting the following variables in /etc/sysconfig/httpd and restart as
> export LANG="en_US.UTF-8"
> export LC_ALL="en_US.UTF-8"
> does not change anything in particular the system default encoding
> which is the reason why the upload is failing.
> Adding such variables to WSGIDaemonProcess:
> WSGIDaemonProcess geonode lang='en_US.UTF-8' locale='en_US.UTF-8'
> user=apache threads=15 processes=2
> just affects the getlocale() function while default encoding is
> unaltered. The only way to affect it would be to add and enforce it:
> import sys
> but this is strongly not recommended and discouraged. More here
> Did anyone already encounter this kind of error? Actually I don't have
> a solution but for sure it's not a bug in geonode code base despite I
> did not figure out the real source.
> Any help and idea, how to overcome it, is welcome :)
> Sent from Nylas Mail
> the best free email app for work
> geonode-users mailing list
> geonode-users at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the geonode-users