diff --git a/script.go b/script.go index 6c0be95..7c5abc5 100644 --- a/script.go +++ b/script.go @@ -5,11 +5,11 @@ import ( "regexp" ) -func ScriptEscape(source []byte) (escaped []byte) { +func ScriptEscape(source string) (escaped string) { rxp2 := regexp.MustCompile("([\"\\\\$])") - source = rxp2.ReplaceAll(source, []byte("\\$1")) + source = rxp2.ReplaceAllString(source, "\\$1") rxp := regexp.MustCompile("\\r?\\n") - escaped = rxp.ReplaceAll(source, []byte("\\r\\\r\n \\n")) + escaped = rxp.ReplaceAllString(source, "\\r\\\r\n \\n") return }