5021: ASCII decode error retrieving DMARC record when attempting email notifs for review request publish

ckerr

What version are you running?

6.0.2

What's the URL of the page containing the problem?

<url>/r/<rev-req-num>

What steps will reproduce the problem?

  1. Create a review request
  2. Add diffs
  3. Publish

What is the expected output? What do you see instead?

Expected to have the review request published straight way. Instead, a popup appears with the text:

"UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7622: ordinal not in range(128)"

What operating system are you using? What browser?

Rocky Linux Version 9.0 (Blue Onyx)

Please provide any additional information below.

This issue only occurs when sending emails related to publishing review request changes (either creating the request, or updating). Emails are sent completely fine to the admin for other things.

I fixed this by adding the argument encoding="utf-8" to the resource_path.open() call within get_dmarc_record().

2023-11-16 11:00:00,708 - ERROR - None - admin - /r/_batch/ - reviewboard.reviews.views.batch - Failed to publish review request 7: 'ascii' codec can't decode byte 0xc3 in position 7622: ordinal not in range(128)
Traceback (most recent call last):
  File "/var/www/<server>/venv/lib/python3.9/site-packages/reviewboard/reviews/views/batch.py", line 416, in _publish
    changes = review_request.publish(
  File "/var/www/<server>/venv/lib/python3.9/site-packages/reviewboard/reviews/models/review_request.py", line 1511, in publish
    review_request_published.send(sender=self.__class__, user=user,
  File "/opt/reviewboard/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send
    return [
  File "/opt/reviewboard/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/var/www/<server>/venv/lib/python3.9/site-packages/reviewboard/notifications/email/signal_handlers.py", l