Skip to content

gcalc chokes on   #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
parkrrr opened this issue Jan 28, 2016 · 0 comments
Open

gcalc chokes on   #151

parkrrr opened this issue Jan 28, 2016 · 0 comments

Comments

@parkrrr
Copy link
Contributor

parkrrr commented Jan 28, 2016

If you do a request that results in a number that is separated with a space skybot will choke. For example, request 1*10000 which will return 10 000:

16:02:35 #ijustam <ijustam> .calc 1*10000
Unhandled exception in thread started by <function run at 0x02C17C30>
Traceback (most recent call last):
  File "core\main.py", line 80, in run
    out = func(input.inp)
  File "plugins\gcalc.py", line 10, in calc
    m = h.xpath('//h2[@class="r"]/text()')
  File "src/lxml/lxml.etree.pyx", line 1587, in lxml.etree._Element.xpath (src\lxml\lxml.etree.c:61854)
  File "src/lxml/xpath.pxi", line 307, in lxml.etree.XPathElementEvaluator.__call__ (src\lxml\lxml.etree.c:178516)
  File "src/lxml/xpath.pxi", line 230, in lxml.etree._XPathEvaluatorBase._handle_result (src\lxml\lxml.etree.c:177452)
  File "src/lxml/extensions.pxi", line 623, in lxml.etree._unwrapXPathObject (src\lxml\lxml.etree.c:171189)
  File "src/lxml/extensions.pxi", line 657, in lxml.etree._createNodeSetResult (src\lxml\lxml.etree.c:171659)
  File "src/lxml/extensions.pxi", line 678, in lxml.etree._unpackNodeSetEntry (src\lxml\lxml.etree.c:171886)
  File "src/lxml/extensions.pxi", line 804, in lxml.etree._buildElementStringResult (src\lxml\lxml.etree.c:173487)
  File "src/lxml/apihelpers.pxi", line 1417, in lxml.etree.funicode (src\lxml\lxml.etree.c:32150)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 6: invalid start byte

The HTML result:
<h2 class="r" style="display:inline;font-size:138%">1 * 10&nbsp;000 = 10&nbsp;000</h2>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant