diff --git a/src/calibre/ebooks/html.py b/src/calibre/ebooks/html.py
index afef1291d3..e9b4d06de4 100644
--- a/src/calibre/ebooks/html.py
+++ b/src/calibre/ebooks/html.py
@@ -573,7 +573,10 @@ class Processor(Parser):
style.tail = '\n'
path = os.path.join(os.path.dirname(self.save_path()), *(style.get('href').split('/')))
self.resource_map[path] = style.get('href')
- open(path, 'wb').write(getattr(sheet, 'cssText', sheet).encode('utf-8'))
+ raw = getattr(sheet, 'cssText', sheet)
+ if isinstance(raw, unicode):
+ raw = raw.encode('utf-8')
+ open(path, 'wb').write(raw)
return Parser.save(self)
def populate_toc(self, toc):
diff --git a/src/calibre/library/test.py b/src/calibre/library/test.py
index 3065e4eec0..1a81755971 100644
--- a/src/calibre/library/test.py
+++ b/src/calibre/library/test.py
@@ -72,6 +72,8 @@ class DBTest(unittest.TestCase):
self.assertEqual(getattr(self.db, x)(2), val)
self.db.set_authors(3, ['new auth'])
+ self.db.refresh_ids([3])
+ self.assertEqual('new auth', self.db.authors(2))
self.assertEqual(self.db.format(3, 'txt', index_is_id=True), 'test')
diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py
index 13d7d0eb19..c7fb812508 100644
--- a/src/calibre/web/feeds/news.py
+++ b/src/calibre/web/feeds/news.py
@@ -541,8 +541,10 @@ class BasicNewsRecipe(object, LoggingInterface):
npos = max(si, gi)
if npos < 0:
npos = pos
-
- return src[:npos+1]+u'\u2026'
+ ans = src[:npos+1]
+ if isinstance(ans, unicode):
+ return
+ return ans+u'\u2026' if isinstance(ans, unicode) else ans + '...'