properly pass along encoding on buf.write, fixes #690
somewhat improved length handling, a few more tests pass
disable unrelated failing test (tracking as https://github.com/tessel/runtime/issues/691)