From 8fbfa3a46f1454ed032d6b82c2843f848d6ce84e Mon Sep 17 00:00:00 2001 From: andym Date: Tue, 4 Dec 2007 05:37:59 +0000 Subject: [PATCH] Added support for entities in enclosure paths. Thanks to Stuart Morgan. --- RSS.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/RSS.m b/RSS.m index 55e9c2c3..bf670593 100644 --- a/RSS.m +++ b/RSS.m @@ -317,7 +317,14 @@ int compareNewsItems(id item1, id item2, void *context) id keyEnumerator = [(NSDictionary *)websiteInfo->attributes keyEnumerator], current; while ((current = [keyEnumerator nextObject])) { - [enclosureDictionary setObject:[(NSDictionary *)websiteInfo->attributes objectForKey:current] forKey:current]; + NSString *escapedAttributeValue = [(NSDictionary *)websiteInfo->attributes objectForKey:current]; + CFStringRef attributeValue = CFXMLCreateStringByUnescapingEntities(kCFAllocatorDefault, (CFStringRef)escapedAttributeValue, NULL); + if (attributeValue) + { + // Do a stringWithString dance rather than just casting so that it's GC safe without using the 10.4+ CFMakeCollectable. + [enclosureDictionary setObject:[NSString stringWithString:(NSString *)attributeValue] forKey:current]; + CFRelease(attributeValue); + } } [itemDictionaryMutable setObject: enclosureDictionary forKey: itemName]; continue;