I can either download the RTF or email it. If I download it then an example of an odd character would look like this “ after opening the document.
If I email it then django will throw an error: "UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 27: ordinal not in range(128)" Emailing with the following code: mail = EmailMessage('Emailing', email_msg, DEFAULT_FROM_EMAIL, all_emails, attachments=[('doc.rtf', rtf_content, 'application/rtf')]) mail.content_subtype = "html" mail.send(fail_silently = False) On Jul 28, 12:29 pm, Vasil Vangelovski <vvangelov...@gmail.com> wrote: > Are you emailing just the rtf document you generate or sending the > contents in the email body as well? > > The problem might be that the content encoding of the rtf or email > message is not set properly. > > cootetom wrote: > > Hello, > > > I'm having some trouble with strange characters that come from MS > > Word. User's are copying text from MS Word, pasting it into a textarea > > on the site. I then save that text into MySQL (table charset is set to > > utf-8). Then later I retrieve that data to create a RTF document then > > an email it to somebody. The problem is that a lot of characters from > > word aren't displaying correctly. > > > Example an " will return \xe2\x80\x93 from the database. What type of > > encoding is that? > > > I've tried running this through all sorts of encoding functions in > > python but haven't had any success, unicode, smart_unicode, decode & > > encode functions. > > > My next guess would be that perhaps these strange characters need to > > be removed before they are saved to the database. Any ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---