I have found other questions/answers about "Incorrect string value" here on stack but none of the answers are working so maybe something is different about my case.
try:
self.cnx = mysql.connector.connect(host='localhost', user='emails', password='***',
database='extractor', raise_on_warnings=True)
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or password")
elif err.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(err)
self.sql = self.cnx.cursor()
biography = str(row[8])
self.sql.execute("""insert into emails (biography)
values(%s)""",
(biography))
where biography
is a utf8mb4_general_ci
TEXT column of:
< Living the 🅗🅘🅖🅗 🅛🅘🅕🅔 > Azofra & Clifford Travel Food Fashion
I get:
mysql.connector.errors.DataError: 1366 (22007): Incorrect string value: '\xF0\x9F\x85\x97\xF0\x9F...' for column `extractor`.`emails`.`biography` at row 1
from Python 3 + Mysql: Incorrect string value '\xF0\x9F\x85\x97\xF0\x9F...'
No comments:
Post a Comment