From 3f464145aafa6052d81f0d7ba6a149bf0c587f41 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 17 Jul 2017 21:59:00 +0400 Subject: [PATCH] web.py: ajout de la fonction _utf8plaintext() --- lib/pyulib/src/ulib/web/pages.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pyulib/src/ulib/web/pages.py b/lib/pyulib/src/ulib/web/pages.py index a5f0104..b5da14e 100644 --- a/lib/pyulib/src/ulib/web/pages.py +++ b/lib/pyulib/src/ulib/web/pages.py @@ -233,6 +233,10 @@ class Page(object): def redirect(self, path, **kw): return web.redirect(web.url(path, **kw)) + def _utf8plaintext(self, text): + web.header("Content-Type", "text/plain; charset=utf-8", True) + return text.encode("utf-8") + def r(self, name, *args, **kw): templatedir = getattr(self, 'TEMPLATEDIR', None) if templatedir is not None: