Fixed #13958 -- problem reporting exception from \r-line-ended file

Thanks petrvanblokland for reporting and saz for the patch