(path string)
| 1220 | runes := utf16.Decode(u16) |
| 1221 | if len(data)%2 == 1 { |
| 1222 | runes = append(runes, '\ufffd') |
| 1223 | } |
| 1224 | return string(runes) |
| 1225 | } |
| 1226 | return string(bytes.ToValidUTF8(data, []byte("\ufffd"))) |
| 1227 | } |
| 1228 | |
| 1229 | func detectLineEndings(content string) string { |
| 1230 | sample := content |
| 1231 | if len(sample) > 4096 { |
| 1232 | sample = sample[:4096] |
| 1233 | } |
| 1234 | crlf := strings.Count(sample, "\r\n") |
| 1235 | lf := strings.Count(sample, "\n") - crlf |
no test coverage detected