summaryrefslogtreecommitdiff
path: root/src/pkg/encoding/json/encode.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-05-02 15:44:51 +0200
committerOndřej Surý <ondrej@sury.org>2012-05-02 15:44:51 +0200
commit0003ee229fd33ff46cb5f2fe1e35f5c0284debc4 (patch)
tree08c48264fd22152f443284397517a1b2be743c34 /src/pkg/encoding/json/encode.go
parent505c19580e0f43fe5224431459cacb7c21edd93d (diff)
downloadgolang-0003ee229fd33ff46cb5f2fe1e35f5c0284debc4.tar.gz
Imported Upstream version 1.0.1upstream/1.0.1
Diffstat (limited to 'src/pkg/encoding/json/encode.go')
-rw-r--r--src/pkg/encoding/json/encode.go9
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