Feeds API and This Character: ’

14 views
Skip to first unread message

Ben Smith

unread,
Jul 16, 2011, 1:13:42 PM7/16/11
to google-ajax...@googlegroups.com
So, I'm using the feeds API to show recent updates from my wordpress based blog on a site.  Everything works perfect except smart quotes.  As you may know, wordpress (in my opinion annoyingly) converts your quotes to smart quotes.  It also does this for the feed.

After the feeds api reads it, it somehow terns this into the html character code (but it does it incorrectly; in the code it is ’ -- so the user sees ’ in the page).  This is the code doing this (as you can see this isn't very complicated):

feed.setNumEntries(5);
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("rssHeap");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var div = document.createElement("div");
div.className = 'rss';
var title = document.createTextNode(entry.title);
var ahref = document.createElement("a");
ahref.className = 'rss_link';
var summerytext = document.createTextNode(entry.contentSnippet);
var summery = document.createElement("div");
summery.className = 'rss_summery';
summery.appendChild(summerytext);
ahref.setAttribute('href', entry.link);
ahref.appendChild(title);
div.appendChild(ahref);
div.appendChild(summery)
container.appendChild(div);
}
}
});
}

omr

unread,
Jul 17, 2011, 8:03:47 AM7/17/11
to Google AJAX APIs
One possibility would be to install a plugin to disable smart quotes.
Here's one, just for example (I haven't tried this one):

http://wordpress.org/extend/plugins/wpuntexturize/

-- omr
Reply all
Reply to author
Forward
0 new messages