File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package jsoniter
22
33import (
44 "fmt"
5- "unicode "
5+ "strings "
66)
77
88// ReadObject read one field from object.
@@ -96,13 +96,12 @@ func (iter *Iterator) readFieldHash() int64 {
9696}
9797
9898func calcHash (str string , caseSensitive bool ) int64 {
99+ if ! caseSensitive {
100+ str = strings .ToLower (str )
101+ }
99102 hash := int64 (0x811c9dc5 )
100- for _ , b := range str {
101- if caseSensitive {
102- hash ^= int64 (b )
103- } else {
104- hash ^= int64 (unicode .ToLower (b ))
105- }
103+ for _ , b := range []byte (str ) {
104+ hash ^= int64 (b )
106105 hash *= 0x1000193
107106 }
108107 return int64 (hash )
Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ func init() {
145145 (* struct {
146146 Field bool `json:",omitempty,string"`
147147 })(nil ),
148+ (* struct {
149+ Field bool `json:"中文"`
150+ })(nil ),
148151 )
149152}
150153
You can’t perform that action at this time.
0 commit comments