Skip to content
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

Add the ability to handle non utf-8 characters #20

Open
amethystdragon opened this issue Aug 14, 2013 · 0 comments
Open

Add the ability to handle non utf-8 characters #20

amethystdragon opened this issue Aug 14, 2013 · 0 comments

Comments

@amethystdragon
Copy link

In the format_results function in the CursorWrapper class in the file base.py the rows are run through an encoding process where they are encoded to utf-8.

I am using the FreeTDS driver with this library so self.driver_needs_utf8 is always True.

I have a problem where the MSSQL database I am interfacing with contains non-utf-8 characters. I have have only read access to the database and no control over the it to make changes that would resolve this.

In order to continue using the database I have two fixes.

One:
change ling 349 from: fr.append(row.decode('utf-8'))
to: fr.append(row.encode('ISO-8859-1').decode('utf-8'))

Two:
Override the init method in the CursorWrapper to automatically set driver_needs_utf8 to be False.

Would it be possible to incorporate a way in the options for the database to either encode from the database into what the database is encoded in and then decode it to utf-8 or setting the driver_needs_utf8 to be false in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants