WJT's "Miscellaneous bug and pyodbc compatibility fixes" + extra unicode fixes

This PR just consists of https://github.com/jiangwen365/pypyodbc/pull/13 plus one extra Unicode fix I found was necessary to prevent pypyodbc from core dumping with an error about a double free.