Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64012 - website/public_html/beta/feed
From: daniel_james_at_[hidden]
Date: 2010-07-14 14:17:22


Author: danieljames
Date: 2010-07-14 14:17:20 EDT (Wed, 14 Jul 2010)
New Revision: 64012
URL: http://svn.boost.org/trac/boost/changeset/64012

Log:
Use unicode strings in bbook2rss.py

When using minidom, creating a text node with a utf-8 encoded string
breaks 'toxml'. Using unicode strings instead, and then a codec to
write the rss file in utf-8.
Text files modified:
   website/public_html/beta/feed/bbook2rss.py | 9 +++++----
   1 files changed, 5 insertions(+), 4 deletions(-)

Modified: website/public_html/beta/feed/bbook2rss.py
==============================================================================
--- website/public_html/beta/feed/bbook2rss.py (original)
+++ website/public_html/beta/feed/bbook2rss.py 2010-07-14 14:17:20 EDT (Wed, 14 Jul 2010)
@@ -7,7 +7,7 @@
 import optparse
 import time
 import xml.dom.minidom
-from xml.sax.saxutils import unescape, escape
+import codecs
 
 class BoostBook2RSS:
 
@@ -79,7 +79,8 @@
         else:
             out = sys.stdout
         if out:
- self.rss.writexml(out,encoding='utf-8')
+ writer = codecs.lookup('utf-8')[3](out)
+ self.rss.writexml(writer, encoding='utf-8')
     
     #~ Turns the internal XML tree into an output UTF-8 string.
     def tostring(self):
@@ -148,9 +149,9 @@
             'item',
             title_xhtml,
             self.new_text('pubDate',node.getAttribute('last-revision')),
- self.new_text('boostbook:purpose',brief_xhtml.toxml('utf-8')),
+ self.new_text('boostbook:purpose',brief_xhtml.toxml()),
             download_item,
- self.new_text('description',description_xhtml.toxml('utf-8'))
+ self.new_text('description',description_xhtml.toxml())
             )
     
     def x__text(self,node):


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk