Skip to content

Reading history file fails with non-latin chars on Windows #55

@ankostis

Description

@ankostis

On Windows and Python 3-6, reading history file that contains non-Latin chars fails with this error:

$ python
Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site.py", line 418, in register_readline
    readline.read_history_file(history)
  File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
    self.mode._history.read_history_file(filename)
  File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
    for line in open(filename, 'rt'):
  File "D:\Apps\WinPython-64bit-3.6.1.0Qt5\python-3.6.1.amd64\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1818: character maps to <undefined>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions