mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix unicode support in CSV catalog output
This commit is contained in:
parent
d96910f3ea
commit
03c5a395f3
@ -69,7 +69,7 @@ class CSV_XML(CatalogPlugin):
|
||||
outfile = open(path_to_output, 'w')
|
||||
|
||||
# Output the field headers
|
||||
outfile.write('%s\n' % ','.join(fields))
|
||||
outfile.write(u'%s\n' % u','.join(fields))
|
||||
|
||||
# Output the entry fields
|
||||
for entry in data:
|
||||
@ -80,15 +80,15 @@ class CSV_XML(CatalogPlugin):
|
||||
item = ', '.join(item)
|
||||
if x < len(fields) - 1:
|
||||
if item is not None:
|
||||
outstr += '"%s",' % str(item).replace('"','""')
|
||||
outstr += u'"%s",' % unicode(item).replace('"','""')
|
||||
else:
|
||||
outstr += '"",'
|
||||
else:
|
||||
if item is not None:
|
||||
outstr += '"%s"\n' % str(item).replace('"','""')
|
||||
outstr += u'"%s"\n' % unicode(item).replace('"','""')
|
||||
else:
|
||||
outstr += '""\n'
|
||||
outfile.write(outstr)
|
||||
outfile.write(outstr.encode('utf-8'))
|
||||
outfile.close()
|
||||
|
||||
elif self.fmt == 'xml':
|
||||
|
Loading…
x
Reference in New Issue
Block a user