Golang unicode <--> 中文

strconv.QuoteToASCII(s string)    // 文本转 unicode
strconv.Unquote(s string)         // unicode 转文本
raw_text := "你好"
quote_text := strconv.QuoteToASCII(raw_text)
println(quote_text)
unquote_text, _ := strconv.Unquote(quote_text)
println(unquote_text)

"\u4f60\u597d"
你好
101 views
Comments
登录后评论
Sign In