convert 8 bit strings to unicode before running the query

This commit is contained in:
Jean-Francois Dockes
2013-06-06 13:24:35 +02:00
parent 75cf5582d6
commit 64bf013114
2 changed files with 7 additions and 3 deletions
+5 -2
View File
@@ -1,10 +1,12 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A python version of the command line query tool recollq (a bit simplified)
The input string is always interpreted as a query language string.
This could actually be useful for something after some customization
"""
import sys
import locale
from getopt import getopt
try:
@@ -93,6 +95,7 @@ def doquery(db, q):
if len(sys.argv) < 2:
Usage()
language, localecharset = locale.getdefaultlocale()
confdir=""
extra_dbs = []
# Snippet params
@@ -113,9 +116,9 @@ for opt,val in options:
if len(args) == 0:
print >> sys.stderr, "No query found in command line"
Usage()
q = ""
q = u''
for word in args:
q += word + " "
q += word.decode(localecharset) + u' '
print "QUERY: [", q, "]"
db = recoll.connect(confdir=confdir,