Repository navigation
Reading history file fails with non-latin chars on Windows - #6
Conversation
|
oh, this one look tricky! I know @brgirgis already did some fixes in just about these same places. @ankostis |
|
The The "replace" error handling is a safety measure not to crash in case of invalid utf-8 sequences. |
|
I've also had written the above this in the docstring of the "private" constant. |
|
@ankostis |
|
I didn't chang the fall-back logic - simply changed it from ASCI -> UTF-8. I believe you agree ion that. Additionally replaced read/write history-files, from binary --> text when opening them, in a context-manager. Finally, i introduced an intermediate fall-back variable, used when opening textual files. I will push a fix commit able the last point. |
without explicetely forcing any encoding, as discussed at pyreadline3#6 (comment)
+ Use io.open() to pass `encoding='utf-8'` when opening history-file. + Use `with ...` resource management not to leak file-handles. + The errors was: UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 1818: character maps to <undefined> - In PR: brgirgis/pyreadline3#1 - Old PR: pyreadline/pyreadline3#51 - FIX: pyreadline/pyreadline#55
- Overcome encoding errors when reading/writing textual streams. - Stop writting bin-streams but rely on `io.open()` for converting encodings. Probably a simplicfication to apply elsewhere in code. - In PR: brgirgis/pyreadline3#1 - Old PR: pyreadline/pyreadline3#51 - enh: pyreadline/pyreadline#55
Introduced a new `_pyreadline_fallback_codepage` constant, probably should reuse throughout code instead of 'ascii' sttring. UNVALIDATED if this change breaks stuff in edge cases!! - In PR: brgirgis/pyreadline3#1 - Old PR: pyreadline/pyreadline3#51 - FIX: pyreadline/pyreadline#55
without explicetely forcing any encoding, as discussed at pyreadline3#6 (comment)
|
@ankostis You still didn't fix the typo I first reported above. |
|
I'm cluless to where your report is? Did i react to it? ... have no recollection of it. |
|
@ankostis You coded: but should be: |
|
I can't see anything at line 12. |
|
@ankostis
|
Introduced a new `_pyreadline_fallback_codepage` constant, probably should reuse throughout code instead of 'ascii' sttring. UNVALIDATED if this change breaks stuff in edge cases!! - In PR: brgirgis/pyreadline3#1 - Old PR: pyreadline/pyreadline3#51 - FIX: pyreadline/pyreadline#55 rebase UTF
without explicetely forcing any encoding, as discussed at pyreadline3#6 (comment)
|
Thank you, fixed it. Regarding your review-comment, the comments accumulate until you submit the review, you're sure you had clicked this? |
|
Again its needs your workflow-approval; could it be that i'm rewriting commits, instead of appending? |
|
@ankostis I believe the "maintainer" of this repo @brgirgis could involve himself a little bit more... or at least consider giving us some more rights do do what's necessary to help maintain it. I see you force pushed, which is normally not a good idea as it messes up the git for everyone else. In addition Bassem should probably create a dev branch for these things, so that things can get merged and tested more easily without breaking stuff. Otherwise I have to clone also your fork... |
|
@brgirgis |
|
Please add a couple of test cases to cover this change. |

A band-aid PR that fixes pyreadline/pyreadline#49 and pyreadline/pyreadline/#55 on non-latin commands in history-file.