django and character set

Asked 2 years ago, Updated 2 years ago, 50 views

Hi, everyone. When deleting data from django, in the column in Korean,

(1366, "Incorrect string value: '\\xED\\x85\\x8C\\xEC\\x8A\\xA4...' for column 'object_repr' at row 1")

An error occurs. Mysql's DB and column character set are utf8mb4. I also set up 'OPTIONS': {'charset': 'utf8mb4'},

There is no problem when saving it, but there is only a problem when deleting it.

I'm asking you a question because I can't solve it even if I google it ^

^

django python mysql

2022-09-21 16:18

1 Answers

I searched and it says it's not Python, but MYSQL.

ALTER TABLE database.table MODIFY COLUMN col VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

Change the column setting on the problematic table like this.


2022-09-21 16:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.