normalize line endings
This commit is contained in:
parent
5a5ad3e6c6
commit
ed74ab60e4
1 changed files with 3 additions and 0 deletions
3
main.go
3
main.go
|
|
@ -57,6 +57,9 @@ func processCommand(plugin Plugin, command string) error {
|
||||||
}
|
}
|
||||||
if command[0] == 't' {
|
if command[0] == 't' {
|
||||||
text := command[1:]
|
text := command[1:]
|
||||||
|
// normalize line endings
|
||||||
|
text = strings.Replace(text, "\r\n", "\n", -1)
|
||||||
|
text = strings.Replace(text, "\r", "\n", -1)
|
||||||
if !utf8.ValidString(text) {
|
if !utf8.ValidString(text) {
|
||||||
return errors.New("invalid utf-8")
|
return errors.New("invalid utf-8")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue