Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode emoji not decoded properly #23

Closed
albandus opened this issue Apr 4, 2017 · 1 comment
Closed

Unicode emoji not decoded properly #23

albandus opened this issue Apr 4, 2017 · 1 comment

Comments

@albandus
Copy link

albandus commented Apr 4, 2017

With the code below, the first line will show bad decoded chars, while the second one, with standard unmarshal function is OK.

package main

import (
	"encoding/json"

	"github.com/tidwall/gjson"
)

const input = `{"utf8":"Example emoji, KO: \ud83d\udd13, \ud83c\udfc3 OK: \u2764\ufe0f "}`

func main() {
	value := gjson.Get(input, "utf8")
	println(value.String())

	var s string
	json.Unmarshal([]byte(value.Raw), &s)
	println(s)
}
@tidwall tidwall closed this as completed in e0cd4f2 Apr 4, 2017
@tidwall
Copy link
Owner

tidwall commented Apr 4, 2017

@albandus Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants