Japanese books on a Kindle 4

Five years ago I realized Amazon deems Japanese books incompatible with the Kindle 4 and suggested using 青空文庫 as an alternative source for e-books. While I wholeheartedly suggest you always search for DRM free sources for your e-books first, there are cases where Amazon simply seems to be the only available source.

In the following I’m going to show a viable way to handle Japanese e-books from Amazon, for people still holding on to a Kindle 4.

what does work

  • vertical writing with PDFs
  • Japanese file names

what doesn’t seem to work

  • vertical writing with AZW3 files
  • highlighting text in vertical writing
  • links (e.g. from the TOC) in vertical writing
  • proper dictionary function

Before jumping right into the technical stuff, be reminded that if you’re okay with reading on your PC or phone, the easy solution is to just get the Kindle app and have your e-book delivered to that. If it is to be the Kindle, here’s how that works:

If you’re on Linux, get a Windows 10 VM, install the Kindle app and load the books you want to transfer to your kindle from your library. Now, word has it there are ways to free books you bought from Amazon from their DRM. For the purpose of this explanation we’re just going to assume you have a DRM free AZW3 file. If you prefer to read your book in horizontal writing, you’re basically done at this point. Copy the file to your Kindle and curse Amazon for not allowing you to send it to the device directly. For verical writing there are a few more steps to go through.

If you haven’t already done so, download Calibre and add a book (probably a AZW3-file) to your collection. To generate a PDF with vertical writing we’re going to use 青空キンドル which takes plain text as input. Unfortunately, exporting a book as TXT in Calibre will mess with furigana (append them as normal text). To get proper furigana, export the book as HTMLZ and from the resulting archive extract the file index.html. To convert the HTML file into plain text while preserving furigana in a format 青空キンドル understands, use the script html2txt_ruby.py from this repository. Running python3 html2txt_ruby.py index.html will give you a file out.txt. Use this as your input for 青空キンドル (you will most likely want to edit the first few lines of the text to get a proper cover page).

Now, PDF file names. Five years ago I noticed problems with book names when just copying over PDF files with Japanese names. The Kindle takes the author’s name from a PDF’s metadata, but doesn’t do this for the title. The title is taken from the file name and non Latin characters in file names can be a mess to deal with on FAT file systems. To get Japanese file names for PDFs properly displayed, mount your kindle with the parameter -o uni_xlate=1* and use the script uni_xlate_filename.py from this repository generate an encoded file name. Example: running python3 uni_xlate_filename.py 使用例 will give you :4f7f:7528:4f8b. Meaning if you name a PDF file on your Kindle :4f7f:7528:4f8b.pdf while mounted with the parameter mentioned above, it will show up as 使用例 on the device.

And with that you can enjoy Japanese books from Amazon in vertical writing on a Kindle 4. No need to abandon a device that’s still working perfectly fine. :)

*See man page of mount (search for “unhandled Unicode”) for details.

2018-09-20