Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF-8 characters in repo description break check script #8

Open
laugmanuel opened this issue Jul 2, 2020 · 0 comments
Open

UTF-8 characters in repo description break check script #8

laugmanuel opened this issue Jul 2, 2020 · 0 comments

Comments

@laugmanuel
Copy link

If there is a repo containing UTF-8 characters in it's description, the script fails with the following error:

Traceback (most recent call last):
  File "./check_katello_sync.py", line 370, in <module>
    main(options)
  File "./check_katello_sync.py", line 355, in main
    check_products()
  File "./check_katello_sync.py", line 158, in check_products
    check_product(product)
  File "./check_katello_sync.py", line 106, in check_product
    product["label"], product["description"], product["last_sync"][0:19]
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 322: ordinal not in range(128)

This is caused by:

LOGGER.debug("Product '{0}' ({1}) was synced at {2}".format(
product["label"], product["description"], product["last_sync"][0:19]

If this line is changed to the following, the script works again:

        LOGGER.debug("Product '{0}' ({1}) was synced at {2}".format(
            product["label"], (product["description"] or '').encode('utf8'), product["last_sync"][0:19]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant