ruby 2.0 compatibility: use String#bytesize rather than #length to determine how many bytes will be written to channels