From 100a1d58e068b949abab68552929d32cb5d9c4dc Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 10 Jan 2013 23:08:29 +0000 Subject: [PATCH] Convert to/from utf-8 for Atom/RSS git-svn-id: file:///home/phd/archive/SVN/phdru.name/scripts@137 7bb0bf08-9e0d-0410-b083-99cee3bf18b8 --- make-news.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/make-news.py b/make-news.py index 29ebe9d..ec27986 100755 --- a/make-news.py +++ b/make-news.py @@ -2,7 +2,7 @@ # -*- coding: koi8-r -*- __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2006-2012 PhiloSoft Design" +__copyright__ = "Copyright (C) 2006-2013 PhiloSoft Design" import sys, os from news import get_news, write_if_changed @@ -73,6 +73,7 @@ if lang == "ru": namespace["baseURL"] = baseURL = "http://phdru.name/Russian/" for item in news_items: item.baseURL = baseURL + item.title = item.title.decode('koi8-r').encode('utf-8') for item in news_items: href_parts = item.rel_link.split('/') @@ -85,7 +86,7 @@ for item in news_items: category = href_parts[0] if category: item.categoryList = [category] -atom_tmpl = str(atom_10(searchList=[namespace])) +atom_tmpl = unicode(atom_10(searchList=[namespace])).encode('koi8-r') write_if_changed(os.path.join(root, "atom_10.xml"), atom_tmpl) -rss_tmpl = str(rss_20(searchList=[namespace])) +rss_tmpl = unicode(rss_20(searchList=[namespace])).encode('koi8-r') write_if_changed(os.path.join(root, "rss_20.xml"), rss_tmpl) -- 2.39.5