[NTLK] Converting NewtonBooks to ePub

Matthias Melcher m.melcher at robowerk.de
Wed Feb 25 16:01:43 PST 2026



> On 25. Feb 2026, at 14:28, J Caffiney <caffiney at gmail.com> wrote:
> 
> Matthias,
> 
> Thanks, this is exactly the kind of detail I was hoping someone had. Your
> breakdown of the style run structure matches what I've been able to piece
> together.
> 
> The style runs were the main puzzle (figuring out that the numbers are
> character counts and not byte offsets into the text string), with each
> count/style pair applied sequentially. Once that clicked, most of the
> formatting came through.

Newton uses Unicode 16bit characters in MSB order, a simplified UTF16 format. Every character is always exactly 2 bytes, and for U.S., French, and German ROMs translates into MacRoman. Sharp and Japanese ROMs default to alternative tables, but the overll character set is pretty limited (less than 512 characters).

ePub uses UTF-8, so you can translate any Newton 16 bit character directly and without loss into UTF-8.

Also check out the "Newton Book Maker User’s Guide". Page 4-11 explains a little bit. 4-16 lists reserved slot names, giving more hints how the format works.

Appendix A lists all Book Script commands and attributes. It's very likely that they map closely to the generated Newton Objects.


Ok, it's late. For the very brave among you, there is a private copy of the newton framework at https://github.com/MatthiasWM/newton-framework.git . The "restructure" branch can be built with cmake on macOS (and probably others). The project contains a target "newtc" which is my little allrounder for package file management.

So if you manage to build the newtc target, you can use the following line to read the book package and output the content. No formatting yet or page layout, no images, just the raw ASCII text.

newtc -pkg 'my/path/to/A Midsummer Nights Dream.pkg' -ohtml ~/dev/test.html

If you just want the raw package contents, use

newtc -pkg 'my/path/to/A Midsummer Nights Dream.pkg' -print


"
...
Come, come to me,
With hands as pale as milk;
Lay them in gore,
Since you have shore
With shears his thread of silk.
Tongue, not a word.
Come, trusty sword;
Come, blade, my breast imbrue.    
[Stabs herself]

And farewell, friends;
Thus Thisby ends;
Adieu, adieu, adieu. 
...                     
"


More information about the NewtonTalk mailing list