grip icon indicating copy to clipboard operation
grip copied to clipboard

Error while displaying special characters

Open L30Bola opened this issue 8 years ago • 2 comments

So I have file with characters like ê õ á ç ì. When I start grip it looks normal (* Running on http://localhost:6419/ (Press CTRL+C to quit)) but when I open the browser window and navigate to localhost:6419, it gives me a 500 Internal Error. On the terminal windows this is the Traceback:

[2016-07-08 18:59:47,107] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\flask\app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\grip\app.py", line 163, in _render_page
    text = self.reader.read(subpath)
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\grip\readers.py", line 265, in read
    return self._read_text(filename)
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\site-packages\grip\readers.py", line 146, in _read_text
    return f.read()
  File "c:\users\coppe\appdata\local\programs\python\python35\lib\codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf5 in position 68: invalid start byte
127.0.0.1 - - [08/Jul/2016 18:59:47] "GET / HTTP/1.1" 500 -

This error only shows up on Windows (tested on Windows 10, Firefox/Chrome). On my Linux (Fedora 23) it is working without issues.

L30Bola avatar Jul 08 '16 22:07 L30Bola

Thank you for documenting this error @L30Bola. I also had this issue for and , but I wouldn't even have guessed it if you hadn't documented this bug.

Efreeto avatar Mar 28 '17 18:03 Efreeto

is this something that is prioritized to fix? It occurs both in python 2.7 and python 3.4.. it triggers on my norwegian special characters 'æ ø å'

Python 3

[2017-05-10 12:40:37,034] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/grip/app.py", line 163, in _render_page
    text = self.reader.read(subpath)
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/grip/readers.py", line 265, in read
    return self._read_text(filename)
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/site-packages/grip/readers.py", line 146, in _read_text
    return f.read()
  File "/home/skandix/.virtualenvs/grippy3/lib/python3.4/codecs.py", line 313, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 167: invalid continuation byte

Python 2.7

[2017-05-10 12:44:24,841] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/grip/app.py", line 163, in _render_page
    text = self.reader.read(subpath)
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/grip/readers.py", line 265, in read
    return self._read_text(filename)
  File "/home/skandix/.virtualenvs/markdownLive/local/lib/python2.7/site-packages/grip/readers.py", line 146, in _read_text
    return f.read()
  File "/home/skandix/.virtualenvs/markdownLive/lib/python2.7/codecs.py", line 296, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xc3 in position 167: invalid continuation byte

skandix avatar May 10 '17 09:05 skandix