Even more improved HTML cleaning
authorteknolog
Sat, 27 Feb 2010 15:59:19 +0000
changeset 19 9219912415dc
parent 18 cda6e6257514
child 20 c92d8384952c
Even more improved HTML cleaning
application/src/PodcastFeedView.cpp
engine/src/PodcastUtils.cpp
--- a/application/src/PodcastFeedView.cpp	Sat Feb 27 14:40:44 2010 +0000
+++ b/application/src/PodcastFeedView.cpp	Sat Feb 27 15:59:19 2010 +0000
@@ -119,11 +119,6 @@
     
     iUpdater = CPodcastFeedViewUpdater::NewL(*this);
 	DP("CPodcastFeedView::ConstructL END");
-	
-	TBuf<1024> test;
-	test.Copy(_L("Yeah, we&#8217;re doing an episode. &quot;hej&quot; &copy; fl&nbsp;ong Should you get used to it?  Ummm&#8230; maybe not.  But let&#8217;s enjoy the ride while it lasts! Today we just yammer on about whatever, mostly just about what we&#8217;ve been up to.  Until next time!"));
-	
-	PodcastUtils::CleanHtmlL(test);
 	}
     
 CPodcastFeedView::~CPodcastFeedView()
--- a/engine/src/PodcastUtils.cpp	Sat Feb 27 14:40:44 2010 +0000
+++ b/engine/src/PodcastUtils.cpp	Sat Feb 27 15:59:19 2010 +0000
@@ -71,10 +71,9 @@
 // miscellaneous cleanup
 	const TChar KLineBreak(CEditableText::ELineBreak); 
 	_LIT(KNewLine, "\n");
-	//	ReplaceChar(str, '"', '\'');
+	_LIT(KNewLineWindows, "\r\n");
 	ReplaceString(str, KNewLine, KNullDesC);
-	str.Trim();
-
+	ReplaceString(str, KNewLineWindows, KNullDesC);
 
 // strip out HTML tags
 	
@@ -198,6 +197,19 @@
 		}
 		
 	CleanupStack::PopAndDestroy(tmpBuf);
+	
+	// chop away newlines at start
+	while (str[0] == KLineBreak) {
+		str = str.Mid(1);
+	}
+	
+	// chop away newlines at end
+
+	while (str[str.Length()-1] == KLineBreak) {
+		str = str.Left(str.Length()-1);
+	}
+
+	str.Trim();
 }
 
 EXPORT_C void PodcastUtils::RemoveAllFormatting(TDes & aString)