Certbot UnicodeDecodeError

My domain is:
jinjiusolutions.com

I ran this command:
# sudo certbot --nginx --nginx-server-root /www/server/nginx/conf/

(After ran the command ‘# sudo certbot --nginx’.)

It produced this output:

Select the appropriate numbers separated by commas and/or spaces, or leave input

blank to select all options shown (Enter 'c' to cancel): 3

Obtaining a new certificate

Performing the following challenges:

http-01 challenge for jinjiusolutions.com

Cleaning up challenges

An unexpected error occurred:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 14: ordinal not in range(128)

Please see the logfiles in /var/log/letsencrypt for more details.

My web server is (include version):The operating system my web server runs on is (include version):
centos_7_06_64 & Nginx 1.14.2

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know): yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
yes.
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
certbot 0.31.0

I didn’t find any non-ASCII character in nginx.conf and ran grep to verifier :

And /var/log/letsencrypt/letsencrypt.log shows:

...
2019-06-03 16:14:06,437:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/bin/certbot", line 9, in <module>
    load_entry_point('certbot==0.31.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 1365, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 1119, in run
    certname, lineage)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 121, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/usr/lib/python2.7/site-packages/certbot/client.py", line 410, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
  File "/usr/lib/python2.7/site-packages/certbot/client.py", line 353, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
  File "/usr/lib/python2.7/site-packages/certbot/client.py", line 389, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, best_effort)
  File "/usr/lib/python2.7/site-packages/certbot/auth_handler.py", line 75, in handle_authorizations
    resp = self._solve_challenges(aauthzrs)
  File "/usr/lib/python2.7/site-packages/certbot/auth_handler.py", line 139, in _solve_challenges
    resp = self.auth.perform(all_achalls)
  File "/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py", line 1068, in perform
    http_response = http_doer.perform()
  File "/usr/lib/python2.7/site-packages/certbot_nginx/http_01.py", line 60, in perform
    self.configurator.save("HTTP Challenge", True)
  File "/usr/lib/python2.7/site-packages/certbot_nginx/configurator.py", line 998, in save
    self.parser.filedump(ext='')
  File "/usr/lib/python2.7/site-packages/certbot_nginx/parser.py", line 243, in filedump
    out = nginxparser.dumps(tree)
  File "/usr/lib/python2.7/site-packages/certbot_nginx/nginxparser.py", line 134, in dumps
    return str(RawNginxDumper(blocks.spaced))
  File "/usr/lib/python2.7/site-packages/certbot_nginx/nginxparser.py", line 98, in __str__
    return ''.join(self)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 14: ordinal not in range(128)
2019-06-03 16:14:06,439:ERROR:certbot.log:An unexpected error occurred:

Need help, thank you!

Hi @evaime

that's the

ç: LATIN SMALL LETTER C WITH CEDILLA

Check your Certbot-config files and your webserver config files.

/usr/lib/python2.7/site-packages/certbot/tests/display/ops_test.py:313:        all_invalid = ["??????ps.net", "uni??od??.com"]
/usr/lib/python2.7/site-packages/certbot/tests/display/ops_test.py:314:        two_valid = ["example.com", "??ni????de.com", "also.example.com"]
/usr/lib/python2.7/site-packages/certbot/tests/display/ops_test.py:327:                                          "uni??od??.com")
/usr/lib/python2.7/site-packages/certbot/tests/display/ops_test.py:352:                                          "uni??od??.com")
/usr/lib/python2.7/site-packages/certbot/tests/main_test.py:1223: names = ['uni **??** od **??** .com']

???

Hello, where’re these Certbot-config files?
Why these packages auto-installed decodes ‘ç’?

# echo $LANG

en_US.UTF-8

Check the files in

/etc/letsencrypt/renewal

It's not an UTF-8 coded char. Hex e7 as UTF-8 -> two bytes - %C3%A7

Maybe in a comment.

Thanks for your answer. Could you tell me how to resolve the problem?

There is not any files in ./renewal

You have already the grep command. Use that to find that file.

What are these '_test.py' files using for? Can i just delete the test files directly?

def test_get_valid_domains(self):
        from certbot.display.ops import get_valid_domains
        all_valid = ["example.com", "second.example.com",
                     "also.example.com", "under_score.example.com",
                     "justtld", "*.wildcard.com"]
        all_invalid = ["öóòps.net", "uniçodé.com"]
        two_valid = ["example.com", "úniçøde.com", "also.example.com"]
        self.assertEqual(get_valid_domains(all_valid), all_valid)
        self.assertEqual(get_valid_domains(all_invalid), [])
        self.assertEqual(len(get_valid_domains(two_valid)), 2)

Parts of the file "ope_test.py"

I don't think it's a problem of these test files.

test files are not touched in normal software use, they are only used by the software developers to verify that it works according to a narrow set of typical use before shipping to users. The domain name that you see are the one picked by developers as typical, they have no relation to production. That the test files are shipped with production software is only a by product of packaging limitations in fact. Don’t take them in account.
About your problem, maybe you could share nginx -T ? If you post the output on this forum, use the quoting magic of Discourse (the server software used on this forum), use three backticks ``` on a separate line to trigger text paste mode. Or post a link to a file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.