Rewrite of the IO library, including Unicode support