Non-ASCII characters encoded as valid UTF-8 are correctly transported in a form that can be decoded at the receiving end.
(self)
| 1068 | ) |
| 1069 | |
| 1070 | def test_attach_utf8_text_as_bytes(self): |
| 1071 | """ |
| 1072 | Non-ASCII characters encoded as valid UTF-8 are correctly transported |
| 1073 | in a form that can be decoded at the receiving end. |
| 1074 | """ |
| 1075 | msg = EmailMessage() |
| 1076 | msg.attach("file.txt", b"\xc3\xa4\n") # UTF-8 encoded a-umlaut. |
| 1077 | filename, content, mimetype = self.get_decoded_attachments(msg)[0] |
| 1078 | self.assertEqual(filename, "file.txt") |
| 1079 | self.assertEqual(content, "ä\n") # (decoded) |
| 1080 | self.assertEqual(mimetype, "text/plain") |
| 1081 | |
| 1082 | def test_attach_non_utf8_text_as_bytes(self): |
| 1083 | """ |
nothing calls this directly
no test coverage detected