From 5cf26e28fa62a697bb12969973b37951311cd273 Mon Sep 17 00:00:00 2001 From: Lionel Dricot Date: Mon, 14 Feb 2022 11:54:51 +0100 Subject: [PATCH] improve unicode handling and rss detection --- offpunk.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/offpunk.py b/offpunk.py index d8a2784..61ca6f7 100755 --- a/offpunk.py +++ b/offpunk.py @@ -757,6 +757,9 @@ _FORMAT_RENDERERS = { "text/gemini": GemtextRenderer, "text/html" : HtmlRenderer, "text/xml" : FeedRenderer, + "application/xml" : FeedRenderer, + "application/rss+xml" : FeedRenderer, + "application/atom+xml" : FeedRenderer, "text/gopher": GopherRenderer, "image/*": ImageRenderer } @@ -1474,7 +1477,8 @@ class GeminiClient(cmd.Cmd): mime = response.headers['content-type'] body = response.content if "text/" in mime: - body = response.text + #body = response.text + body = response.content.decode("UTF-8","replace") else: body = response.content gi.write_body(body,mime)