-
Notifications
You must be signed in to change notification settings - Fork 564
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
Connection errors give wrong message string on big-endian systems #563
Comments
kadler
added a commit
to kadler/pyodbc
that referenced
this issue
Apr 26, 2019
system, but when a connection failure occurs the encoding was still hard-coded to utf-16-le which causes mojibake on big endian systems. Instead use ENCSTR_UTF16NE, which will be either utf-16-le or utf-16-be, depending on the native endian for the system. Fixes mkleehammer#563
kadler
added a commit
to kadler/pyodbc
that referenced
this issue
Apr 26, 2019
In mkleehammer#255, the code was changed to use the native endianness of the system, but when a connection failure occurs the encoding was still hard-coded to utf-16-le which causes mojibake on big endian systems. Instead use ENCSTR_UTF16NE, which will be either utf-16-le or utf-16-be, depending on the native endian for the system. Fixes mkleehammer#563
mkleehammer
pushed a commit
that referenced
this issue
Jul 31, 2019
In #255, the code was changed to use the native endianness of the system, but when a connection failure occurs the encoding was still hard-coded to utf-16-le which causes mojibake on big endian systems. Instead use ENCSTR_UTF16NE, which will be either utf-16-le or utf-16-be, depending on the native endian for the system. Fixes #563
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:
Issue
Connection errors gives mojibake on big-endian systems:
This is due to hardcoding the encoding to "utf-16-le" when a connection is NULL: https://github.com/mkleehammer/pyodbc/blob/master/src/errors.cpp#L294
If I change the encoding to "utf-16-be", I get the correct error message:
Looks like this should use
ENCSTR_UTF16NE
which seems to have been missed from #255.The text was updated successfully, but these errors were encountered: