Ticket #4690 (closed defect: fixed)
Error while sending book with non-ascii character in title/author to device
| Reported by: | alcik | Owned by: | kovidgoyal |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Default | Version: | |
| Keywords: | device, unicode, pathname | Cc: |
Description
When I try to send book with title containing non ascii characters in title or author name to the device I have got this error:
('ascii', u'Lem, Stanis\u0142aw', 11, 12, 'ordinal not in range(128)')
Traceback (most recent call last):
File "/usr/lib/calibre/calibre/gui2/device.py", line 57, in run
self.result = self.func(*self.args, **self.kwargs)
File "/usr/lib/calibre/calibre/gui2/device.py", line 247, in _upload_books
metadata=metadata, end_session=False)
File "/usr/lib/calibre/calibre/devices/usbms/driver.py", line 105, in upload_books
filepath = self.create_upload_path(path, mdata, fname)
File "/usr/lib/calibre/calibre/devices/usbms/device.py", line 815, in create_upload_path
extra_components = get_components(template, mdata, fname)
File "/usr/lib/calibre/calibre/library/save_to_disk.py", line 126, in get_components
components = [x.format(**format_args).strip() for x in components]
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 11: ordinal not in range(128)
Sending books with ascii only titles/authors works great. I noticed that books kept in calibre library on my computer are saved in paths that nonascii character are smartly replaced with ascii characters. It looks like the same should be done when trying to save to the device.
I dont know if it is relevant but my device use FAT32 formatted SD card. Maybe FAT32 has something against unicode characters in file names, I suppose it does. I think it is regression, because I have some ebooks on my device with non ascii characters in titles and I used previous version of calibre to put it there (but cant remember which previous version).
I use calibre 0.6.32 on linux (fedora).
Change History
comment:1 Changed 7 months ago by kovidgoyal
- Status changed from new to closed
- Resolution set to fixed
comment:2 Changed 4 months ago by mike3050
Thank you for the fix. Mike from cheap auto insurance

Fixed in branch trunk. The fix will be in the next release.