| 54 | | if hasattr(FIELD_TYPE, "VARCHAR"): |
|---|
| 55 | | # By default, MySQLdb will return VARCHAR BINARY fields as type str. |
|---|
| 56 | | # This is a bad idea, as BINARY doesn't indicate that it's arbitrary |
|---|
| 57 | | # binary data, but that collation uses the binary representation. |
|---|
| 58 | | # Replacing the list makes it return unicode. MySQLdb later adds |
|---|
| 59 | | # another list entry for non-binary fields. |
|---|
| 60 | | # |
|---|
| 61 | | # MySQLdb 1.2.1p2 doesn't have the VARCHAR attribute, but it also returns |
|---|
| 62 | | # unicode for VARCHAR BINARY columns automatically, so we don't need it |
|---|
| 63 | | # there. |
|---|
| 64 | | django_conversions[FIELD_TYPE.VARCHAR] = [(FLAG.BINARY, |
|---|
| 65 | | lambda s: s.decode('utf-8'))] |
|---|