New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix decoding of binary collations for non-binary character sets #43
Conversation
- Previously relied on BINARY flag, which only indicates that the collation is binary, not whether the character set is - Use character set id to determine whether to tread field as binary. Expanded description tuple to include said id. - WARNING: Unit tests not updated
Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment: |
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow |
Need for help! My setting for MySQL in django is already for utf8mb4. DATABASES = {
'default': {
'ENGINE': 'mysql.connector.django',
'NAME': 'xxxx',
'USER': 'xx',
'PASSWORD': 'xxxxxxxx',
'HOST': '127.0.0.1',
'PORT': '3306',
'OPTIONS': {
'autocommit': True,
'use_pure': True,
'charset': 'utf8mb4',
'collation': 'utf8mb4_unicode_ci'
}
}
} And my MySQL database is also setted into utf8mb4 for characterset and collation. I migrated my table before. It's OK. But today I added some tables, and then migrate them. It throws error:
I really do not know why it throws the error. I was using And the detail:
Thanks for any help. |
Summary
Currently this library uses
FieldFlag.BINARY
/BINARY_FLAG
to decide whether to decode a field or to leave it as raw bytes (when said flag is set). However, this appears to be incorrect behaviour.The C API documentation states:
And the BINARY/VARBINARY section also confirms this:
Example
(Used Python 3.5.2)
Actual results:
Expected results:
Notes
description
field has been expanded to include an additional entry (the field character set id) and theBINARY
flag is no longer used for decoding logic, some test cases now most likely fail.