The problem with this is that chr(0) is the terminating character for a string and it iis not possible to read beyond this point.
If the data was internally stored as some thing besides strings it would be fine but because arbitrary variable lengths are required it is currently impossible.
http://esp8266basic.com
A BASIC interpreter for your ESP
Working now on Autodrop3d. A 3d printer with automatic part ejection system. https://autodrop3d.com