Revert to #readlines#join, but enclose it in a function

This is necessary to preserve the handling
of \r\n and \n line endings.