core: Rewrite string reader.