Skip to content

Can't put emoji (mariadb) #1376

@Salamandar

Description

@Salamandar

When trying to add an element with an emoji, here's what happens in the logs:

sqlalchemy.exc.DataError: (pymysql.err.DataError) (1366, "Incorrect string value: '\\xF0\\x9F\\xAB\\xA0\\xEF\\xB8...' for column `ihatemoney`.`bill`.`what` at row 1")
[SQL: INSERT INTO bill (payer_id, amount, date, creation_date, what, external_link, original_currency, converted_amount, archive) VALUES (%(payer_id)s, %(amount)s, %(date)s, %(creation_date)s, %(what)s, %(external_link)s, %(original_currency)s, %(converted_amount)s, %(archive)s)]
[parameters: {'payer_id': 1, 'amount': 0.0, 'date': datetime.date(2025, 4, 12), 'creation_date': datetime.datetime(2025, 4, 12, 16, 7, 34, 555522), 'what': '🫠️ test', 'external_link': '', 'original_currency': 'XXX', 'converted_amount': 0.0, 'archive': None}]
(Background on this error at: https://sqlalche.me/e/14/9h9h)

Database was created with utf8mb4 charset:

MariaDB [ihatemoney]> SHOW CREATE DATABASE ihatemoney;
+------------+---------------------------------------------------------------------------------------------------+
| Database   | Create Database                                                                                   |
+------------+---------------------------------------------------------------------------------------------------+
| ihatemoney | CREATE DATABASE `ihatemoney` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ |
+------------+---------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

and here's the connection URI:

SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://ihatemoney:<PASSWORD>@localhost/ihatemoney?charset=utf8mb4'

(i just added the ?charset=utf8mb4 hoping it would fix the issue, but after a restart the issue is still present)

I would hope it's just a configuration issue… but everything seems okay.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions