Certbot fails to create certificates with nginx when there is non-ascii characters in config files when using python 2.7 and CentOS 7.5. In my case there is non-ascii characters also in relevant parts of configuration like server_name fields, so removing non-ascii characters is not an option.
I have resolved issues by changing parser.py to use io.open instead of default open with encoding set as UTF-8 (ie. io.open(item, “r”, encoding=‘utf-8’)). And also use unicode instead of str in nginxparser.py. This solution should work with Python 2.6 and later.
However, I’m not sure if this solution is generic enough to be added to official package. So, I created this topic to discuss this matter further.