django-mailbox icon indicating copy to clipboard operation
django-mailbox copied to clipboard

Fix default_charset and _process_message() to accept emojis in utf-8 encode

Open lologf opened this issue 6 years ago • 6 comments

This fix works in python 2.7, django 1.11 and database with charset utf8 and collation ut8_general_ci. I can't changing charset and collation of production database for an emoji in email subject.

https://github.com/coddingtonbear/django-mailbox/pull/198

lologf avatar Jan 18 '19 11:01 lologf

Is this issue going to be fixed soon? I am getting errors because of emoji's in email subject.

sanderroosendaal avatar Sep 24 '19 09:09 sanderroosendaal

As far as i’m aware, this isn’t an issue for users using a properly configured database, @sanderroosendaal — you may want to look into that first.

Relatedly, the associated PR above isn’t one that is mergeable for a variety of reasons; so the answer is not likely to be one you want to hear.

coddingtonbear avatar Sep 24 '19 12:09 coddingtonbear

@coddingtonbear Understood, but what is a proper database setting? djang-mailbox set my mysql database to utf8mb4_unicode_ci for the subject field. This generates an error on fetching the email.

sanderroosendaal avatar Sep 24 '19 15:09 sanderroosendaal

It’s very difficult to say without having at least a traceback; do you happen to have one?

coddingtonbear avatar Sep 24 '19 16:09 coddingtonbear

Just to be clear — this module is not involved in selecting your collation, so the proper fix is outside in your django/db settings. Without knowing more, I might suggest the following resources:

  • http://blog.manbolo.com/2014/03/31/using-emojis-in-django-model-fields
  • https://stackoverflow.com/questions/44496101/how-to-insert-emoji-into-mysql-5-5-and-higher-using-django-orm

coddingtonbear avatar Sep 24 '19 16:09 coddingtonbear

thanks for replying. I do have a traceback but don't want to clutter your issues list. I will check the links you kindly provided.

sanderroosendaal avatar Sep 24 '19 17:09 sanderroosendaal

The setting has ben fixed on main (but there is no release date yet)

pfouque avatar Dec 17 '23 07:12 pfouque