問題: Python以cx_Oracle取Oracle DB資料時, 出現illegal multibyte sequence error
原因: 預設使用Big5, 但DB中有簡體字, 無法轉換
解法: 加註encoding = 'UTF-8'
conn = cx_Oracle.connect(user='u',password ='pw', dsn=dsn_tns, encoding = 'UTF-8')
Ref:
1.How to handle unicode data in cx_Oracle and python 2.7?
https://stackoverflow.com/questions/49174710/how-to-handle-unicode-data-in-cx-oracle-and-python-2-7
2.Random character is displayed when unicode data is fetched
https://github.com/oracle/python-cx_Oracle/issues/157
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。