UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 672: invalid start byte

Hello, this is my first post. Certbot has run flawlessly until now.

My domain is:

I ran this command:
certbot --authenticator webroot --webroot-path /var/www/sites/k/kiropraktikk-helse.no/www_20/ --installer nginx -d kph.x.dittweb.no --debu

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1365, in main
return config.func(config, plugins)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1101, in run
installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, “run”)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 228, in choose_configurator_plugins
installer = pick_installer(config, req_inst, plugins, installer_question)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 32, in pick_installer
config, default, plugins, question, (interfaces.IInstaller,))
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 106, in pick_plugin
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 251, in prepare
return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 251, in
return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 132, in prepare
File “/usr/lib/python3/dist-packages/certbot_nginx/configurator.py”, line 152, in prepare
self.parser = parser.NginxParser(self.conf(‘server-root’))
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 38, in init
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 45, in load
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 66, in _parse_recursively
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 56, in _parse_recursively
trees = self._parse_files(filepath)
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 207, in _parse_files
parsed = nginxparser.load(_file)
File “/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py”, line 123, in load
return loads(_file.read())
File “/usr/lib/python3.5/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x93 in position 672: invalid start byte
Please see the logfiles in /var/log/letsencrypt for more details.

My web server is (include version):
nginx/1.10.3 (Ubuntu)

The operating system my web server runs on is (include version):
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial

My hosting provider, if applicable, is:

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

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):

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

1 Like

Certbot’s nginx configuration parser has trouble with non-ASCII text.

You can try locate the offending text using:

grep -R -P "[^\x00-\x7F]" /etc/nginx
1 Like

Tried, and no luck…
That is: Found, removed characters (“) and still having a problem…

Hi @MrLeif

x0093 =


(Unicode-Codepoint - Hex-Code - Character name)

isn’t a visible char, it’s a Control Char. So you may have problems to see it.

1 Like

Thanks. How do I find/remove it? :slight_smile:

1 Like

Use a hex editor to find the position.

Then use the hex editor to change that char. Or use a text editor to remove it with the spaces.

1 Like

Since it does not report what file the error occurs in, I need to find all files that it might be in…
How would I search for it in e.g. /etc/nginx ?

Use a modified command of the command @_az has shared.

To find only the 0x93 char.

But there

you have found something. So start there. You don’t see the character using a text editor.

1 Like

After being tipped about this page;

I ended up trying adding LANG=en_US.iso88591 before the command, and voila!..
So the final command for creating a new certificate now looks like this

LANG=en_US.iso88591 certbot --authenticator webroot --webroot-path /full/path/to/web --installer nginx -d web.hostname.com

Thanks for your help and interest in my problem, I hope this might help someone else. :slight_smile: