作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
字符串在数据库中存储为 unicode "\u0435\u043e ..."(表的编码为 UTF-8)。
从数据库中选择并打印后:
日志.Println(str)
输出:\u0435\u043e...
如何将此字符串转换为 utf 格式?
最佳答案
要解码你拥有的字符串,你可以这样做:
import "net/url"
...
url.QueryUnescape("\u0435\u043e")
但我认为您的数据库或连接参数配置错误,因为这应该是自动处理的。这不是 utf-8 顺便说一句。
关于unicode - 如何在 Go 中将 unicode 字符串从数据库转换为 utf 字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32782239/
我是一名优秀的程序员,十分优秀!