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
2
2
3
3
import (
4
4
"fmt"
5
- "unicode "
5
+ "strings "
6
6
)
7
7
8
8
// ReadObject read one field from object.
@@ -96,13 +96,12 @@ func (iter *Iterator) readFieldHash() int64 {
96
96
}
97
97
98
98
func calcHash (str string , caseSensitive bool ) int64 {
99
+ if ! caseSensitive {
100
+ str = strings .ToLower (str )
101
+ }
99
102
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 )
106
105
hash *= 0x1000193
107
106
}
108
107
return int64 (hash )
Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ func init() {
145
145
(* struct {
146
146
Field bool `json:",omitempty,string"`
147
147
})(nil ),
148
+ (* struct {
149
+ Field bool `json:"中文"`
150
+ })(nil ),
148
151
)
149
152
}
150
153
You can’t perform that action at this time.
0 commit comments