Another patch from Alain Tauch (stripHtml enhancements) - thanks!
git-svn-id: svn://svn.berlios.de/gpodder@43 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
parent
dc75c37a02
commit
52fc2f57dd
|
@ -1,3 +1,6 @@
|
|||
Sun, 19 Mar 2006 18:38:42 +0100 <thp@perli.net>
|
||||
+ Applied another patch from A. Tauch (stripHTML enhancements)
|
||||
|
||||
Sun, 19 Mar 2006 15:11:32 +0100 <thp@perli.net>
|
||||
+ Applied two patches from A. Tauch <contrib@maisondubonheur.com>:
|
||||
* fix for local db writer's encoding -> is now really iso-8859-1)
|
||||
|
|
|
@ -19,7 +19,7 @@ class writeLocalDB( object):
|
|||
ofile = None
|
||||
|
||||
def __init__( self, filename, channel):
|
||||
self.ofile = codecs.open( filename, "w", 'iso-8859-1')
|
||||
self.ofile = codecs.open( filename, "w", 'iso-8859-1', 'replace')
|
||||
self.ofile.write( '<?xml version="1.0" encoding="ISO-8859-1"?>'+"\n")
|
||||
self.ofile.write( '<!-- local download database, generated by gPodder -->'+"\n")
|
||||
self.ofile.write( '<rss version="2.0">'+"\n")
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
import gtk
|
||||
import gobject
|
||||
import htmlentitydefs
|
||||
|
||||
import libgpodder
|
||||
|
||||
|
@ -216,5 +217,11 @@ def channelsToModel( channels):
|
|||
|
||||
def stripHtml( html):
|
||||
# strips html from a string (fix for <description> tags containing html)
|
||||
dict = htmlentitydefs.entitydefs
|
||||
rexp = re.compile( "<[^>]*>")
|
||||
return rexp.sub( "", html)
|
||||
stripstr = rexp.sub( "", html)
|
||||
# strips html entities
|
||||
for key in dict.keys():
|
||||
stripstr = stripstr.replace( '&'+unicode(key,'iso-8859-1')+';', unicode(dict[key], 'iso-8859-1'))
|
||||
return stripstr
|
||||
|
||||
|
|
Loading…
Reference in New Issue