mirror of
				https://github.com/kovidgoyal/calibre.git
				synced 2025-10-31 02:27:01 -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') |             outfile = open(path_to_output, 'w') | ||||||
| 
 | 
 | ||||||
|             # Output the field headers |             # Output the field headers | ||||||
|             outfile.write('%s\n' % ','.join(fields)) |             outfile.write(u'%s\n' % u','.join(fields)) | ||||||
| 
 | 
 | ||||||
|             # Output the entry fields |             # Output the entry fields | ||||||
|             for entry in data: |             for entry in data: | ||||||
| @ -80,15 +80,15 @@ class CSV_XML(CatalogPlugin): | |||||||
|                         item = ', '.join(item) |                         item = ', '.join(item) | ||||||
|                     if x < len(fields) - 1: |                     if x < len(fields) - 1: | ||||||
|                         if item is not None: |                         if item is not None: | ||||||
|                             outstr += '"%s",' % str(item).replace('"','""') |                             outstr += u'"%s",' % unicode(item).replace('"','""') | ||||||
|                         else: |                         else: | ||||||
|                             outstr += '"",' |                             outstr += '"",' | ||||||
|                     else: |                     else: | ||||||
|                         if item is not None: |                         if item is not None: | ||||||
|                             outstr += '"%s"\n' % str(item).replace('"','""') |                             outstr += u'"%s"\n' % unicode(item).replace('"','""') | ||||||
|                         else: |                         else: | ||||||
|                             outstr += '""\n' |                             outstr += '""\n' | ||||||
|                 outfile.write(outstr) |                 outfile.write(outstr.encode('utf-8')) | ||||||
|             outfile.close() |             outfile.close() | ||||||
| 
 | 
 | ||||||
|         elif self.fmt == 'xml': |         elif self.fmt == 'xml': | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user