Golang Charmap解码器在容器中不起作用
我在UI应用程序上显示DB2数据。后端服务连接到DB2并获取数据。 DB2在土耳其字符(“İ,ü,ç,黑))上存在问题,这就是为什么我添加了使用Charmap软件包的函数的原因。
func decodeIso8859(byteSlice string) string {
decoder := charmap.ISO8859_9.NewDecoder()
decodedByteSlice, _ := decoder.String(byteSlice)
return decodedByteSlice
}
当从DB2返回数据时,我用上述函数解码了数据。当直接在我的主机上运行时,它毫无问题地运行。但是,当在本地集装箱中运行代码时,它不起作用。它不会给出任何错误,只需显示“ []”或“ \ u001”而不是土耳其字符。
I show DB2 data on my UI application. Backend service connects to the DB2 and gets data. DB2 had problems with Turkish characters("İ,ü,ç,ş") that's why I added a function which use Charmap package.
func decodeIso8859(byteSlice string) string {
decoder := charmap.ISO8859_9.NewDecoder()
decodedByteSlice, _ := decoder.String(byteSlice)
return decodedByteSlice
}
When data returned from DB2 I decoded the data with above function. When ran directly on my host, it runs without any problem. However, when run the code in a container locally, it does not work. It does not gives any error just show "[]" or "\u001" instead of Turkish characters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论