StringReader has the following regex in it to try and normalize line endings: this._input = text.replace(/\n\r?/g, "\n"); Which should probably be: this._input = text.replace(/\r\n?/g, "\n"); <!--- @huboard:{"order":146.5,"milestone_order":133,"custom_state":""} -->