Migrating from Notecase to CherryTree

So I have a few documents which started life in TreePad. Then about 8 years ago I migrated them to Notecase, for reasons I don't remember. I hadn't opened them for a few months, but when I opened one in Notecase last week, I found out that they'd removed the everlasting Trial mode and they now have only a 30-day trial or paid modes. The prices are not unreasonable, but given that I hadn't opened any documents in the 6 months since they implemented the change, I decided to look for another Note Organizer. My search took me to CherryTree.

CherryTree claims to be able to import from Notecase. However I tried various experiments, exporting to HTML, to Notecase HTML, plain text, MD, etc, but I couldn't get it to import any of the notes nested as originally intended. I could have sat there and dragged them around with the mouse until they were in the right place, and that would have been do-able, but a boring couple of hours. So I looked further.

I found mention in the Github Issues page of CherryTree that the previous version of CherryTree was able to correctly import the notes structure from NoteCase. But that since the developer is in the process of migrating the code from python to c++ (I think), then that functionality had been abandoned until he can re-implement it. I tried to find old versions of the app as flatpak, snap, and AppImage, but there weren't any. So here's the convoluted story of how I got it to work.

  • Download Ubuntu 16.04 Desktop and install it as a virtual machine in VirtualBox
  • Install the relevant CherryTree 0.34 version from here.
  • Export from the current NoteCase file as a notecase ncd. (ncdb and ncz formats don't work). In order to get Notecase to start in 30 day trial mode I needed to first remove the ~/.notecase/ directory contents.
  • Open the ncd file in CherryTree 0.34 on Ubuntu 16. Save as CherryTree .ctb format.
  • Copy files back to main machine where they could be opened with a recent version of CherryTree.

OK, so now that's looking good, except all the notes are imported as rtf instead of plain text. Probably not a problem, but in my case it was, as I relied on monospace font for formatting in the originals, so I needed text format. The .ctb file format is in sqlite3, so I used dbeaver to examine it, and came up with the following SQL code to change all the rtf notes into txt notes.

# Strip rtf header and footer from note
UPDATE node SET txt = REPLACE(txt,'<?xml version="1.0" ?><node><rich_text>','') WHERE is_richtxt = "1";
UPDATE node SET txt = REPLACE(txt,'</rich_text></node>','') WHERE is_richtxt = "1";
# Set flags
UPDATE node SET syntax = "plain-text" WHERE is_richtxt = "1";
UPDATE node SET is_richtxt = "0" WHERE is_richtxt = "1";

And that was that. Probably more work than I initially intended, but the journey is part of the fun.

Leave a Comment