Bug #70543 Columns created as utf8_bin are returned as str instead of Unicode.
Submitted: 7 Oct 2013 16:08 Modified: 6 May 2022 16:54
Reporter: Rui Pacheco Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / Python Severity:S2 (Serious)
Version:1.0.12 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[7 Oct 2013 16:08] Rui Pacheco
Description:
I have a database (5.5.32-0ubuntu0.13.04.1) with all tables and columns defined as utf8_bin.

While trying to understand why MySQL was returning str instead of unicode I came across the following error in another driver: http://sourceforge.net/p/mysql-python/bugs/289/

Mistakenly thinking I was using that connector, I changed the column type from utf8_bin to utf8_general_ci and the unicode excaption UnicodeDecodeError disappeared.

How to repeat:
Create a database with columns as utf8_bin and try to retrieve data. type() shows it's str. Change the column types to utf8_general_ci. type() now shows it's unicode.
[13 Jan 2014 8:53] Geert Vanderkelen
We checked this a while ago, but status was not changed to Verified.

Thanks for the report!
[18 Mar 2014 7:14] Daniƫl van Eeden
I believe this is Python 2 specific and doesn't happen in Python 3.
[6 May 2022 16:54] Philip Olson
Unfortunately it appears this bug was lost/forgotten over time, I'm closing with a status update:

* 22 Mar 2017: Developer stated the bug cannot be reproduced, with Python 2 or 3
* Python 2 isn't supported in C/Py 8.0 anyways