[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [lego/master] Fix plugin



commit 4911d14b482d292742f5f0e30130e4b6817f56f8
Author: hiro <hiro@xxxxxxxxxxxxxx>
Date:   Thu Sep 5 15:57:25 2019 +0200

    Fix plugin
---
 packages/txt-to-html/lektor_txt_to_html.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/packages/txt-to-html/lektor_txt_to_html.py b/packages/txt-to-html/lektor_txt_to_html.py
index 48b86d1..3fba7e9 100644
--- a/packages/txt-to-html/lektor_txt_to_html.py
+++ b/packages/txt-to-html/lektor_txt_to_html.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+    # -*- coding: utf-8 -*-
 #pylint: disable=wrong-import-position
 import sys
 
@@ -18,7 +18,8 @@ class TxtToHtmlPlugin(Plugin):
 
         def text(url=None):
             webFile = request.urlopen(url)
-            content = webFile.read()
+            charset = webFile.info().get_content_charset()
+            content = webFile.read().decode(charset)
             text ="<pre>" + content + "</pre>"
 
             return text

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits