diff options
Diffstat (limited to 'src/pkg/encoding/json/encode.go')
-rw-r--r-- | src/pkg/encoding/json/encode.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go index 14957b848..842672c39 100644 --- a/src/pkg/encoding/json/encode.go +++ b/src/pkg/encoding/json/encode.go @@ -17,6 +17,7 @@ import ( "runtime" "sort" "strconv" + "strings" "sync" "unicode" "unicode/utf8" @@ -415,9 +416,11 @@ func isValidTag(s string) bool { return false } for _, c := range s { - switch c { - case '$', '-', '_', '/', '%': - // Acceptable + switch { + case strings.ContainsRune("!#$%&()*+-./:<=>?@[]^_{|}~", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. default: if !unicode.IsLetter(c) && !unicode.IsDigit(c) { return false |