Skip to content
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

"IndexError: list index out of range" when given a non-ascii string #1

Open
GoogleCodeExporter opened this issue Jan 14, 2016 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Execute nilsimsa.Nilsimsa(text).hexdigest() where text contains non-ascii 
characters (Korean (UTF-8), in my case)
2.
3.

What is the expected output? What do you see instead?
I should produce a hexdigest.

What version of the product are you using? On what operating system?
Python 2.7.3
Linux quantal64 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux
Distributor ID: Ubuntu
Description:    Ubuntu 12.10
Release:        12.10
Codename:       quantal

Please provide any additional information below.

Execute nilsimsa.Nilsimsa('호준이는 비싼 학비 때문에 허리가 
휘어집니다').hexdigest()

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/vagrant/app/core.py", line 420, in lsh
    row.original_text_lsh = nilsimsa.Nilsimsa(row.original_text).hexdigest()
  File "/usr/local/lib/python2.7/dist-packages/nilsimsa/__init__.py", line 97, in __init__
    self.update(chunk)
  File "/usr/local/lib/python2.7/dist-packages/nilsimsa/__init__.py", line 112, in update
    self.acc[self.tran3(ch, self.lastch[0], self.lastch[1], 0)] +=1
  File "/usr/local/lib/python2.7/dist-packages/nilsimsa/__init__.py", line 101, in tran3
    return (((TRAN[(a+n)&255]^TRAN[b]*(n+n+1))+TRAN[(c)^TRAN[n]])&255)
IndexError: list index out of range

Original issue reported on code.google.com by [email protected] on 10 Apr 2013 at 8:07

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

No branches or pull requests

1 participant