mysql - How to fix "Incorrect string value" errors? -
Looking at an application to abandon random email due to incorrect string value errors, I went though and used Several text columns have changed utf8
column charset and default column collate ( utf8_general_ci
) so that they can accept them. Most of the definitive errors, and non-Latin emails were stopped while stopping SQL errors.
Nevertheless, some emails still have irresis: (incorrect string value: column '' xx4 \ xC5 \ xCC \ xC9 \ xD3 \ xD8 'for column' content '' on line 1 with incorrect string value ... ')
Content column is a MEDIUMTEXT
datatyb which is utf8
column charset and utf8_general_ci
column Uses coated. There are no flags that I can toggle in this column.
Considering that I do not want to touch the application source code, unless it is necessary:
- What is the reason for that error? (Yes, I know that email is full of random garbage, but I think UTF 8 will be very approbatory)
- How can I fix this?
- Is this okay?
One thing I believed was that UTF was changing with variant of binary flag in varchar ([some large number]), but I am unfamiliar with MySQL, and I do not know if One such kind of thing is understandable.
"\ xE4 \ xC5 \ xCC \ xC9 \ xD3 \ XD8"
Valid UTF-8 is not tested using Python:
gt; & Gt; "\ XE4 \ xC5 \ xCC \ xC9 \ xD3 \ xD8" .decode ("utf-8") ... Unicodecode error: 'utf8' can not decode a byte in codec position 0-2: invalid data
If you are exploring a way to avoid decoding errors within the database, then cp1252 encoding (aka "Windows-1252" aka "Windows Western European") is the most approved encoding - every byte Value is a valid code point.
Definitely this is not to understand the actual UTF-8, nor to other non-CP 1252 encoding, but it seems that you are not worried about it?
Comments
Post a Comment