dotslash / recent2

Swiss army knife to query bash history
https://pypi.org/project/recent2/
MIT License
9 stars 4 forks source link

Handle unicode chars properly #27

Open dotslash opened 4 years ago

dotslash commented 4 years ago
(bash) >15:01:56 $ å
bash: å: command not found
Traceback (most recent call last):
  File "/usr/local/bin/log-recent", line 10, in <module>
    sys.exit(log())
  File "/usr/local/lib/python2.7/site-packages/recent2.py", line 173, in log
    return_value, pwd, session.id])
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
dotslash commented 4 years ago

Im not able to reproduce this image

dotslash commented 4 years ago

ssh connection got interrupted and when I press , log-recent fails with this

Traceback (most recent call last):
  File "/Users/sai.suram/miniconda3/envs/bash/bin/log-recent", line 8, in <module>
    sys.exit(log())
  File "/Users/sai.suram/miniconda3/envs/bash/lib/python3.7/site-packages/recent2.py", line 256, in log
    log_command(command=command, pid=pid, sequence=sequence, return_value=return_value, pwd=pwd)
  File "/Users/sai.suram/miniconda3/envs/bash/lib/python3.7/site-packages/recent2.py", line 269, in log_command
    [int(time.time()), command, pid, return_value, pwd, session.id])
UnicodeEncodeError: 'utf-8' codec can't encode character '\udc9d' in position 0: surrogates not allowed