View Single Post
Old 07-23-2014, 09:20 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,435
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is nothing special you need to so to set unicode values. unicode objects in python are not utf-8, they are either utf-16 or ucs-4 depending on compile time options.

Where are you getting u_genre from?

If you want to set a unicode value pass in a unicode string not a bytestring. That means,

Code:
if isintance(u_genre, bytes):
  u_genre = u_genre.decode('utf-8')

Last edited by kovidgoyal; 07-23-2014 at 09:28 AM.
kovidgoyal is offline   Reply With Quote