Change buffer to behave like a stream
Add missing encoding to ruby files for consistency