Browse files

fix encoding issue and reset file stream

  • Loading branch information...
1 parent 8e58742 commit 2b90bf75fa330501ec874f3bacc9d8bee226ae2f @posativ committed Aug 28, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 regenwolken/specs.py
  2. +1 −1 regenwolken/templates/text.html
View
2 regenwolken/specs.py
@@ -185,7 +185,7 @@ def istext(self):
blocksize = 512
chars = b''.join(int2byte(i) for i in range(32, 127)) + b'\n\r\t\f\b'
- block = self.read(blocksize)
+ block = self.read(blocksize); self.seek(0)
if b'\x00' in block:
# Files with null bytes are binary
return False
View
2 regenwolken/templates/text.html
@@ -14,7 +14,7 @@
{% elif drop.iscode and config.SYNTAX_HIGHLIGHTING %}
<pre><code>{{ drop.code | safe }}</code></pre>
{% else %}
- <pre><code>{{ drop.read() }}</code></pre>
+ <pre><code>{{ drop.read().decode("utf-8") }}</code></pre>
{% endif %}
</section>
{% endblock %}

0 comments on commit 2b90bf7

Please sign in to comment.