pombreda / pypyodbc

Automatically exported from code.google.com/p/pypyodbc
0 stars 0 forks source link

use mbdtools,chinese character encoded by gb charset can't access correctly #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

What is the expected output? What do you see instead?

when pyptodbc 1.3.3 to read a mdb include chinese character encoded by 
gb(gbk,gb2312 or gb18030) charset, use the default parameter for connect 
function, it returns not chinese character but unrecognized character, the 
number and english character is normal. 

when i change the parameter unicode_results to False of connect function,
read some column (include chinese character) of bytes, and decode it to 
UTF-8,like this:

>>> conn=pypyodbc.connect('Driver=MDBTools;DBQ=/path/to/record.mdb', 
unicode_results=False)
>>> conn.cursor().execute('SELECT * FROM Build').fetchone()[0].decode('UTF-8')

the result is what i expected, it's exactly the chinese character, it's amazing!

so, i believe the mdbtools odbc driver already convert chinese charac ter from 
gb charset to unicode charset, if convert again will be all mess up.

What version of the product are you using? On what operating system?

1.3.3 on debian jessie amd64

Please provide any additional information below.
I writed a post to discribe this, the url is  
http://openwares.net/linux/pypyodbc_gb_mdb_mess.html

Original issue reported on code.google.com by changuoq...@gmail.com on 15 Aug 2014 at 12:23

Attachments: