[patch] convert_unicode flag is not properly enforce with MSSQL dialect

Issue #1291 resolved
Former user created an issue

Since 0.5.0 (it worked in 0.5.0rc4) the new types system of MSSQL dialect has introduced a new _StringType that does not implement the unicode convertion in the result processor.

This means that the result data for Text columns are not converted to unicode objects anymore.

Please find attached a patch that fixes this.

I would like to add a unit test to this (I have a mssql test env setup) but unfortunately I don't know where to pass the convert_unicode flag to the mssql engine to test this.

Comments (12)

  1. Former user Account Deleted

    Please this is not a minor issue. This is a big regression that provokes all textual data coming from MSSQL databases to be returned as python strings instead of unicode objects.

    I have the same problem with pyodb 2.0.35 and 2.1.3

  2. Former user Account Deleted

    and the problem is the same with MSSQL 2000 and MSSQL 2005

    the good new is that my patch solves the issue with both 2000 and 2005

  3. Mike Bayer repo owner

    Replying to guest:

    Please this is not a minor issue.

    well that's why priority is "medium" and not "low" ;) the "severity" indicates how long it will take to fix the issue. clearly its just a choice of "process unicode, dont process unicode" so the level of code involved is not great.

    we're just trying to determine why our own tests don't have this issue with the current trunk. it does seem so far like tests will remain passing with unicode processing re-enabled.

  4. Former user Account Deleted

    I realised this after clicking submit :) Thanks Mike. I'm trying to help empty find the test pb on IRC right now.

  5. Former user Account Deleted

    attached is a test case demonstrating the error that works once my patch is applied...

    run with :

    python.exe test/dialect/mssql.py --db=mssql QueryUnicodeTest.test_convert_unicode

    (take care of your test.cfg file to have proper mssql2000 database delared)

  6. Log in to comment