スクリプトを Python 2.4 にバックポートしようとしていますが、次のようなエラーが発生し続けます。
Traceback (most recent call last)
File "vuln-excel-processor.py", line 103, in ?
values[row][col] = str(sheet.cell(row + 1, col).value).decode('utf-8')
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 44: ordinal not in range(128)
これが問題のコードブロックです。
for row in range(sheet.nrows - 1):
for col in range(sheet.ncols):
values[row][col] = str(sheet.cell(row + 1, col).value).decode('utf-8')
このエラーPython - Finding unicode/ascii problemsについて説明しているこのページを見つけたので、最後の行に str.decode() の呼び出しを入れるように促されましたが、問題を解決できませんでした。ここで犯人についてのアイデアはありますか?ご協力いただきありがとうございます。