On Sun, Mar 25, 2018 at 3:35 AM, Peter J. Holzer <hjp-pyt...@hjp.at> wrote: > On 2018-03-24 11:21:09 +1100, Chris Angelico wrote: >> If the database has been configured to use UTF-8 (as mentioned, that's >> "utf8mb4" in MySQL), you won't get that byte sequence back. You'll get >> back valid UTF-8. > > Actually (with python3 and mysql.connector), you'll get back str values, > not byte values encoded in utf-8 or latin-1. You don't have to decode > them because the driver already did it. > > So as a Python programmer, you don't care what character set the > database uses internally, as this is almost completely hidden from you > (The one aspect that isn't hidden is of course the set of characters > that you can store in a character field: Obviously, you can't store > Chinese characters in a latin1 field).
Good. I mentioned earlier that that's how it is with PostgreSQL and psycopg2, but wasn't sure about the MySQL interface modules. Glad to know that it is. ChrisA -- https://mail.python.org/mailman/listinfo/python-list