@@ -149,11 +149,45 @@ class TestWolframAlphaNoAPIEngine(SearxTestCase):
149149 </body>
150150 </html>
151151 """
152− # test output in htmlentity
152+ # test output with htmlentity
153153 response = mock.Mock(text=html)
154154 results = wolframalpha_noapi.response(response)
155155 self.assertEqual(type(results), list)
156156 self.assertEqual(len(results), 2)
157− self.assertIn("¥".decode('utf-8'), results[0]['answer'])
157+ self.assertIn('¥'.decode('utf-8'), results[0]['answer'])
158158 self.assertIn('1 euro to yen - Wolfram|Alpha', results[1]['title'])
159159 self.assertEquals('http://www.wolframalpha.com/input/?i=+1+euro+to+yen', results[1]['url'])
160+
161+ html = """
162+ <!DOCTYPE html>
163+ <title> distance from nairobi to kyoto in inches - Wolfram|Alpha</title>
164+ <meta charset="utf-8" />
165+ <body>
166+ <script type="text/javascript">
167+ try {
168+ if (typeof context.jsonArray.popups.pod_0100 == "undefined" ) {
169+ context.jsonArray.popups.pod_0100 = [];
170+ }
171+[...].pod_0100.push( {"stringified": "convert distance | from | Nairobi, Kenya\nto | Kyoto, Japan to inches"});
172+ } catch(e) { }
173+
174+ try {
175+ if (typeof context.jsonArray.popups.pod_0200 == "undefined" ) {
176+ context.jsonArray.popups.pod_0200 = [];
177+ }
178+pod_0200.push({"stringified": "4.295×10^8 inches","mOutput": "Quantity[4.295×10^8,&quot;Inches&quot;]"});
179+
180+ } catch(e) { }
181+ </script>
182+ </body>
183+ </html>
184+ """
185+ # test output with utf-8 character
186+ response = mock.Mock(text=html)
187+ results = wolframalpha_noapi.response(response)
188+ self.assertEqual(type(results), list)
189+ self.assertEqual(len(results), 2)
190+ self.assertIn('4.295×10^8 inches'.decode('utf-8'), results[0]['answer'])
191+ self.assertIn('distance from nairobi to kyoto in inches - Wolfram|Alpha', results[1]['title'])
192+ self.assertEquals('http://www.wolframalpha.com/input/?i=+distance+from+nairobi+to+kyoto+in+inches',
193+ results[1]['url'])