[Answer]-Django Tastypie – serving emoji that are stored in db

1👍

The solution is in DJango settings:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {'charset': 'utf8mb4'},
        (...)

0👍

What if you save the JSON dump to a text file and open it with a UTF8 text editor? Will the emoji re-appear?

I suspect that, when displaying the JSON in the browser, the browser falls back to Latin-1 encoding, thus ending up with question marks. There might be a setting in your browser to set the encoding.

Check the “Content-Type” header that comes from your server. Does it say application/json; encoding=utf-8?

Leave a comment