1
0
mirror of https://github.com/json-iterator/go.git synced 2025-06-24 23:16:47 +02:00

#69 fix unicode support

This commit is contained in:
Tao Wen
2017-06-21 18:25:37 +08:00
parent ff3c624fa9
commit caaa04195e
3 changed files with 90 additions and 37 deletions

View File

@ -136,6 +136,14 @@ func Test_string_encode_with_std_without_html_escape(t *testing.T) {
}
}
func Test_unicode(t *testing.T) {
should := require.New(t)
output , _ := MarshalToString(map[string]interface{}{"a": "数字山谷"})
should.Equal(`{"a":"数字山谷"}`, output)
output , _ = Config{EscapeHtml: false}.Froze().MarshalToString(map[string]interface{}{"a": "数字山谷"})
should.Equal(`{"a":"数字山谷"}`, output)
}
func Benchmark_jsoniter_unicode(b *testing.B) {
for n := 0; n < b.N; n++ {
iter := ParseString(ConfigDefault, `"\ud83d\udc4a"`)