Skip to content

foia_send_email task runs into Unicode Encoding Errors #2098

@duckduckgrayduck

Description

@duckduckgrayduck

This is our most common error on Sentry
https://muckrock.sentry.io/issues/6864839790/?project=996&query=is%3Aunresolved&referrer=issue-stream&sort=freq

A link to the start of the method:

def foia_send_email(foia_pk, comm_pk, options, **kwargs):

Error message: UnicodeEncodeError
'utf-8' codec can't encode characters in position 127-129: surrogates not allowed

Inside of foia_send_email we call send_delayed_email

def send_delayed_email(self, comm, **kwargs):

In this function we probably need to sanitize the email subject and body before sending so that it doesn't fail

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions