Index: RSS.NET/RssFeed.cs
===================================================================
RCS file: /cvsroot/rss-net/RSS.NET/RssFeed.cs,v
retrieving revision 1.4
diff -u -r1.4 RssFeed.cs
--- RSS.NET/RssFeed.cs 3 Sep 2003 03:11:33 -0000 1.4
+++ RSS.NET/RssFeed.cs 25 Oct 2003 17:42:40 -0000
@@ -47,6 +47,7 @@
using System;
using System.IO;
using System.Net;
+using System.Text;
namespace Rss
{
@@ -63,8 +64,12 @@
private bool cached = false;
private string etag = RssDefault.String;
private string url = RssDefault.String;
+ private Encoding encoding = null;
/// Initialize a new instance of the RssFeed class.
public RssFeed() {}
+ /// Initialize a new instance of the RssFeed class with a specified encoding.
+ public RssFeed(Encoding enc) { encoding = enc; }
+
/// Returns a string representation of the current Object.
/// The Url of the feed
public override string ToString()
@@ -112,6 +117,12 @@
{
get { return url; }
}
+ /// Encoding of the feed
+ public Encoding Encoding
+ {
+ get { return encoding; }
+ set { encoding = value; }
+ }
/// Reads the specified RSS feed
/// The url or filename of the RSS feed
/// The contents of the feed
@@ -215,17 +226,20 @@
}
/// Writes the RSS feed to the specified stream.
/// specified Stream
- /// The encoding is ISO-8859-1.
/// The Stream cannot be written to.
/// Feed must contain at least one channel.
/// Channel must contain at least one item.
public void Write(Stream stream)
{
- RssWriter writer = new RssWriter(stream);
+ RssWriter writer;
+
+ if (encoding == null)
+ writer = new RssWriter(stream);
+ else
+ writer = new RssWriter(stream, encoding);
write(writer);
}
/// Writes the RSS feed to the specified file.
- /// The encoding is ISO-8859-1.
/// The filename is empty, contains only white space, or contains one or more invalid characters.
/// Access is denied.
/// The filename is a (null c#, Nothing vb) reference.
@@ -237,7 +251,12 @@
/// Channel must contain at least one item.
public void Write(string fileName)
{
- RssWriter writer = new RssWriter(fileName);
+ RssWriter writer;
+
+ if (encoding == null)
+ writer = new RssWriter(fileName);
+ else
+ writer = new RssWriter(fileName, encoding);
write(writer);
}
private void write(RssWriter writer)