diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9a1aa311..7c27b36f 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -22,6 +22,7 @@ Dominik Roos Eran Duchan Evan Shaw Ian Denhardt +Jake Riesterer James McKaskill Jason E. Aten Johan Hernandez diff --git a/encoding/text/marshal_test.go b/encoding/text/marshal_test.go index 992a520d..f2198e67 100644 --- a/encoding/text/marshal_test.go +++ b/encoding/text/marshal_test.go @@ -59,8 +59,8 @@ func TestEncode(t *testing.T) { {0x81fdbfdc91779421, `(map = [])`, `( map = [] )`}, - {0x8e85252144f61858, `(data = "Hi\xde\xad\xbe\xef\xca\xfe")`, `( - data = "Hi\xde\xad\xbe\xef\xca\xfe" + {0x8e85252144f61858, `(data = "Hi\xde\xad\xbe\xef\xca\xfe\"\'\\")`, `( + data = "Hi\xde\xad\xbe\xef\xca\xfe\"\'\\" )`}, {0xc21398a8474837ba, `(voidList = [void, void])`, `( voidList = [ diff --git a/encoding/text/testdata/txt.capnp b/encoding/text/testdata/txt.capnp index eae50187..6c0aeb73 100644 --- a/encoding/text/testdata/txt.capnp +++ b/encoding/text/testdata/txt.capnp @@ -55,7 +55,7 @@ const mapVal @0xb167974479102805 :Value = (map = [ (key = "foo", value = (void = void)), (key = "bar", value = (void = void)), ]); -const data @0x8e85252144f61858 :Value = (data = 0x"4869 dead beef cafe"); +const data @0x8e85252144f61858 :Value = (data = 0x"4869 dead beef cafe 22275c"); const emptyMap @0x81fdbfdc91779421 :Value = (map = []); const voidList @0xc21398a8474837ba :Value = (voidList = [void, void]); const boolList @0xde82c2eeb3a4b07c :Value = (boolList = [true, false, true, false]); diff --git a/encoding/text/testdata/txt.capnp.out b/encoding/text/testdata/txt.capnp.out index fd5d3cdf..0a25a184 100644 Binary files a/encoding/text/testdata/txt.capnp.out and b/encoding/text/testdata/txt.capnp.out differ diff --git a/internal/strquote/strquote.go b/internal/strquote/strquote.go index f6af09b9..b8d872d9 100644 --- a/internal/strquote/strquote.go +++ b/internal/strquote/strquote.go @@ -43,7 +43,7 @@ func Append(buf []byte, s []byte) []byte { } func needsEscape(b byte) bool { - return b < 0x20 || b >= 0x7f + return b < 0x20 || b >= 0x7f || b == '\'' || b == '"' || b == '\\' } func hexDigit(b byte) byte {