Ver código fonte

Merge pull request #362 from Cqoicebordel/currency_chars

Allow use of chars as € in currency converter
Adam Tauber 9 anos atrás
pai
commit
fc1a8b25b8
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3
    3
      searx/engines/currency_convert.py

+ 3
- 3
searx/engines/currency_convert.py Ver arquivo

@@ -9,7 +9,7 @@ categories = []
9 9
 url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
10 10
 weight = 100
11 11
 
12
-parser_re = re.compile(r'^\W*(\d+(?:\.\d+)?)\W*([^.0-9].+)\W*in?\W*([^\.]+)\W*$', re.I)  # noqa
12
+parser_re = re.compile(u'^\W*(\d+(?:\.\d+)?)\W*([^.0-9].+)\W+in?\W+([^\.]+)\W*$', re.I)  # noqa
13 13
 
14 14
 db = 1
15 15
 
@@ -17,7 +17,7 @@ db = 1
17 17
 def normalize_name(name):
18 18
     name = name.lower().replace('-', ' ')
19 19
     name = re.sub(' +', ' ', name)
20
-    return unicodedata.normalize('NFKD', u"" + name).lower()
20
+    return unicodedata.normalize('NFKD', name).lower()
21 21
 
22 22
 
23 23
 def name_to_iso4217(name):
@@ -35,7 +35,7 @@ def iso4217_to_name(iso4217, language):
35 35
 
36 36
 
37 37
 def request(query, params):
38
-    m = parser_re.match(query)
38
+    m = parser_re.match(unicode(query, 'utf8'))
39 39
     if not m:
40 40
         # wrong query
41 41
         return params