Skip to content

UnicodeEncodeError in nginxparser.py from RawNginxDumper #8146

@jimhavrilla

Description

@jimhavrilla

If you're having trouble using Certbot and aren't sure you've found a bug or
request for a new feature, please first try asking for help at
https://community.letsencrypt.org/. There is a much larger community there of
people familiar with the project who will be able to more quickly answer your
questions.

My operating system is (include version):

CentOS 7, Digital Ocean droplet

I installed Certbot with (certbot-auto, OS package manager, pip, etc):

certbot-auto

I ran this command and it produced this output:

certbot-auto

gave correct domain and everything, certificate works, will not install. Log says there's a unicode error in RawNginxDumper

Certbot's behavior differed from what I expected because:

It should just work since nginx seems to have no issues...

Here is a Certbot log showing the issue (if available):

Logs are stored in /var/log/letsencrypt by default. Feel free to redact domains, e-mail and IP addresses as you see fit.
2020-07-16 20:50:55,377:INFO:certbot_nginx._internal.configurator:Deploying Certificate to VirtualHost /etc/nginx/conf.d/default.conf
2020-07-16 20:50:55,377:DEBUG:certbot.reverter:Creating backup of /etc/nginx/nginx.conf
2020-07-16 20:50:55,378:DEBUG:certbot.reverter:Creating backup of /etc/nginx/conf.d/default.conf
2020-07-16 20:50:55,378:DEBUG:certbot.reverter:Creating backup of /etc/nginx/mime.types
2020-07-16 20:50:55,378:DEBUG:certbot.reverter:Creating backup of /etc/letsencrypt/options-ssl-nginx.conf
2020-07-16 20:50:55,380:DEBUG:certbot._internal.error_handler:Encountered exception:
Traceback (most recent call last):
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot/_internal/client.py", line 521, in deploy_certificate
    self.installer.save()  # needed by the Apache plugin
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_nginx/_internal/configurator.py", line 1051, in save
    self.parser.filedump(ext='')
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_nginx/_internal/parser.py", line 250, in filedump
    out = nginxparser.dumps(tree)
  File "/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_nginx/_internal/nginxparser.py", line 140, in dumps
    return str(RawNginxDumper(blocks.spaced))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 662-663: ordinal not in range(128)

Here is the relevant nginx server block or Apache virtualhost for the domain I am configuring:

nginx conf:

server {
listen 80;
server_name my-domain.org;

location / {
    include uwsgi_params;
    uwsgi_pass unix:/user/project/phencards.sock;
}

}

Certbot also added all the default stuff like listen 443 ssl the cert locations etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions