NormalizeNewlines normalizes \r\n (windows) and \r (mac) into \n (unix)
(d []byte)
| 88 | // NormalizeNewlines normalizes \r\n (windows) and \r (mac) |
| 89 | // into \n (unix) |
| 90 | func NormalizeNewlines(d []byte) []byte { |
| 91 | // replace CR LF \r\n (windows) with LF \n (unix) |
| 92 | d = bytes.Replace(d, []byte{13, 10}, []byte{10}, -1) |
| 93 | // replace CF \r (mac) with LF \n (unix) |
| 94 | d = bytes.Replace(d, []byte{13}, []byte{10}, -1) |
| 95 | return d |
| 96 | } |