[banshee] Fix handling of podcast feeds that don't specify their encoding
- From: Bertrand Lorentz <blorentz src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Fix handling of podcast feeds that don't specify their encoding
- Date: Wed, 29 Apr 2009 16:30:44 -0400 (EDT)
commit e3571217712db29a162abca76e5b674a2203384b
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Wed Apr 29 22:25:35 2009 +0200
Fix handling of podcast feeds that don't specify their encoding
The feed was set as empty if it didn't contain an encoding attribute.
This should at least fix part of BGO#574605.
---
src/Libraries/Migo/Migo.Net/AsyncWebClient.cs | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/Libraries/Migo/Migo.Net/AsyncWebClient.cs b/src/Libraries/Migo/Migo.Net/AsyncWebClient.cs
index 4d1871d..61c3dd9 100644
--- a/src/Libraries/Migo/Migo.Net/AsyncWebClient.cs
+++ b/src/Libraries/Migo/Migo.Net/AsyncWebClient.cs
@@ -726,14 +726,16 @@ namespace Migo.Net
if (s.StartsWith("<?xml")) {
string auxStr = "encoding=";
int startIndex = s.IndexOf (auxStr) + auxStr.Length + 1;
- int endIndex = s.IndexOf ('\"', startIndex);
- string encodingStr = s.Substring (startIndex, endIndex - startIndex);
- try {
- Encoding enc = Encoding.GetEncoding (encodingStr);
- if (!enc.Equals (Encoding)) {
- s = enc.GetString (resultPtr);
- }
- } catch (ArgumentException) {}
+ if (startIndex > auxStr.Length + 1) {
+ int endIndex = s.IndexOf ('\"', startIndex);
+ string encodingStr = s.Substring (startIndex, endIndex - startIndex);
+ try {
+ Encoding enc = Encoding.GetEncoding (encodingStr);
+ if (!enc.Equals (Encoding)) {
+ s = enc.GetString (resultPtr);
+ }
+ } catch (ArgumentException) {}
+ }
}
} catch {
s = String.Empty;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]