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

hiro at torproject.org hiro at torproject.org
Tue Apr 7 16:13:23 UTC 2020


commit 4911d14b482d292742f5f0e30130e4b6817f56f8
Author: hiro <hiro at torproject.org>
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





More information about the tor-commits mailing list