geopython / pywps

PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
https://pywps.org
MIT License
178 stars 117 forks source link

Assume config-files are encoded in utf-8 #531

Closed kvold closed 4 years ago

kvold commented 4 years ago

In python 3.2 configparser added support for the encoding-parameter: https://docs.python.org/3.5/library/configparser.html#configparser.ConfigParser.read Before this configparser just opened the file in whatever open() expected, which again used whatever the local default encoding/character set was.

I'd suggest taking advantage of this update and changing the line which reads the file in pywps/configuration.py to the following: loaded_files = CONFIG.read(config_files, encoding='utf-8')

Right now pywps may or may not crash when reading the config-file depending on whether or not you're: -using any non-ascii characters in the config file. -what the default character set is for your specific machine.

I think it would've been better to always expect a utf-8 config-file, rather than letting it depend on the specific machine.

This might not be viable if pywps still wants to support python 2.7 or python < 3.2

Environment

Steps to Reproduce

Create and load a config-file encoded as utf-8 containing one or more non-ascii characters. OBS: must be done on a machine where the non-ascii character is not a part of the character set used by open() .

Additional Information