andersju / zzzfoo

Full-text desktop search with Rofi+Recoll
GNU General Public License v2.0
121 stars 8 forks source link

unicode trouble #2

Closed wvstolzing closed 6 years ago

wvstolzing commented 6 years ago

Any query -- whether entered via rofi, or the -q option at the command line -- gives me the following error:

Traceback (most recent call last):
  File "./zzzfoo", line 218, in <module>
    main(sys.argv)
  File "./zzzfoo", line 178, in main
    results_list = run_query(recoll_db, args)
  File "./zzzfoo", line 103, in run_query
    results_list.append(process_doc(query, doc, match_obj, args))
  File "./zzzfoo", line 84, in process_doc
    abstract=res['abstract'], absolute_path=absolute_path)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 15: ordinal not in range(128)

If at all relevant, I've installed Recoll from the standard Fedora repositories; but I've had to build the python3 module from source (without any errors), as described in https://www.lesbonscomptes.com/recoll/usermanual/usermanual.html#RCL.PROGRAM.PYTHONAPI.

On its own, Recoll (command line as well as qt ui) works fine.

andersju commented 6 years ago

This sounds like a Python 2 issue. zzzfoo used to support both 2 and 3, but now supports only 3 because of various headaches (such as unicode handling!). Should've changed the first line of the script from #!/usr/bin/env python to #!/usr/bin/env python3 though; sorry about that. Fixed now. Can you try the new version (or just invoke the script with python3 zzzfoo)?

wvstolzing commented 6 years ago

Thanks a lot, it works now. Though oddly, unless I specify maximum lines for rofi on the command line (with -r '-lines x'), the search results extend outside the screen height. Here's a screenshot to illustrate.

This doesn't seem to be related to rofi theming; I tried several themes, and got the same result in each.

andersju commented 6 years ago

Hmm. rofi (in version 1.5 anyway) by default shows 15 lines, but zzzfoo tells rofi to make each "line" (or row) have a height of 3 characters (-eh 3), rather than the default of 1. So 45 actual lines, which might be too much depending on one's environment. I'll set a lower default or at least add a note about it. Thanks!