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

Fix UnicodeEncodeError in PagerDutyAlerter #3182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

katkasian
Copy link

@katkasian katkasian commented May 3, 2021

PagerDutyAlerter class appears to lack handling of non-Latin languages in alert subject / text. Specifically, with Japanese characters HTTP requests fail with the below error:

"UnicodeEncodeError: codec can't encode characters in position 106-125: Body (<redacted>) is not valid Latin-1. Use body.encode(\u0027utf-8\u0027) if you want to send it encoded in UTF-8." ] }'

Tested that specifying encoding as utf-8 on line 1419 of alerts.py resolves the issue.

data=json.dumps(payload, cls=DateTimeEncoder, ensure_ascii=False).encode("utf-8")

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

Successfully merging this pull request may close these issues.

1 participant