strconv.Unquote returns invalid syntax if the string contains `"`. It is 
better to quote string before Unquote.

https://go.dev/play/p/ndfEi9tSjaM

On Thursday, December 29, 2016 at 7:44:07 AM UTC+8 Jakob Borg wrote:
Both json.Unmarshal and strconv.Unquote seem to handle this fine: 

https://play.golang.org/p/mexmJNGQyh 

//jb 

> On 28 Dec 2016, at 15:03, JohnGB <jgbe...@gmail.com> wrote: 
> 
> I tried this with a variety of messages, and it doesn't work with most 
unicode escaped string. For example, the unicode escaped string 
'\u044d\u0442\u043e \u0442\u0435\u0441\u0442 
\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435' should unescape to 
'это тест сообщение' but it unescapes to 'MB> B5AB A>>1I5=85' instead. 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c3d2d310-e998-4027-bc76-cbb1e02fe441n%40googlegroups.com.

Reply via email to