captainbrosset/website.cleanjs — Issue #2: utf8 - ascii encoding problem resulting in error 500 on server
Author: captainbrosset
Created: 2012-01-26 00:16:44+00:00
State: open

If the source code contains utf-8 characters:

ERROR 2012-01-26 00:13:12,543 wsgi.py:186]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 174, in Handle
result = handler(self._environ, self._StartResponse)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1505, in __call__
rv = self.router.dispatch(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1253, in default_dispatcher
return route.handler_adapter(request, response)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1077, in __call__
return handler.dispatch()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 547, in dispatch
return self.handle_exception(e, self.app.debug)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 545, in dispatch
return method(*args, **kwargs)
File "/Users/patrickbrosset/cleanjscode/handlers/report.py", line 12, in get
self.display_report(src_file, index)
File "/Users/patrickbrosset/cleanjscode/handlers/report.py", line 24, in display_report
result = reviewer.review(file_data)
File "/Users/patrickbrosset/cleanjscode/cleanjs/reviewers/reviewer.py", line 7, in review
syntax.Reviewer().review(file_data, message_bag)
File "/Users/patrickbrosset/cleanjscode/cleanjs/reviewers/syntax.py", line 15, in review
ast = jsparser.parse(file_data.content)
File "/Users/patrickbrosset/cleanjscode/cleanjs/reviewers/helpers/jsparser/jsparser.py", line 1138, in parse
t = Tokenizer(source, filename, starting_line_number)
File "/Users/patrickbrosset/cleanjscode/cleanjs/reviewers/helpers/jsparser/jsparser.py", line 197, in __init__
self.source = str(s)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in position 78: ordinal not in range(128)