-
Notifications
You must be signed in to change notification settings - Fork 8k
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
Special HTML chars encoded in JSON respones? #693
Comments
It's just because the curl treat the response as a html,the response is actually right in fact. |
hmm I don't think so. Python requests library shows escaped characters in the response as well.
|
That's normal. Check |
I see, thanks @stxml! Looks like this is the reason:
How can I disable this behavior in my snippet? |
A. make a PR that lets you set this option in gin, or
|
I'd love to submit a PR since I'm new to Go! ✨ Would it make sense implement this as an option to engine config? Which file should I look at, apart from render/json.go? |
I don't think it should be an engine option, since rendering is more dynamic and the engine shouldn't care if you write JSON, XML, etc. Maybe add a new type in json.go: Implement the Render() interface and add a convenience function to context, like c.XML(). Not like c.JSON(), because that doesn't even use Render |
I see that SetEscapeHTML has been added just recently to 1.7. How can I handle that? |
also I see that |
Don't really know how to handle the 1.7 dependency. Go should really have some Availability documentation. |
On the return I used c.String (200, string (json)) my json rode with marshal: json, _: = json.Marshal (customer) |
I've noticed that, in responses from
gin.Context.JSON
, special html characters get escaped, while other unicode characters are treated normally.Here's a handler to reproduce this:
The text was updated successfully, but these errors were encountered: