我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在Golang中解码UTF-16BE CSV文件

I'm trying to decode CSV files encoded in UTF-16BE in Golang. What is the charmap ISO character number that I have to call for the new reader ?

I want to invoke

csv.NewReader(charmap.XXXX.NewDecoder().Reader(file))

What should be the value of XXXX ?

Have you tried this?

https://godoc.org/golang.org/x/text/encoding/unicode#UTF16

unicode.UTF16(BigEndian, UseBOM)

After some review, a simple way to decode UTF16 into UTF8 is provided by this code:

https://gist.github.com/bradleypeabody/185b1d7ed6c0c2ab6cec#file-gistfile1-go

近期文章

  • Golang相当于在Python中创建子流程
  • 无法将流量从“ tun”接口转发到“ lo”
  • scanfl声明变量超出功能
  • 为什么我的自定义错误类型导致特定模式的错误? [重复]
  • 无法使用Golang Gorm连接到RDS Postgres
  • 格式无效:不是PNG文件
  • 使用DNSutil从域中提取名称服务器| dns.RR类型没有字段或方法Hdr
  • jenkins 出现以下问题, 使用 docker rpm 包都如此
  • 计算机机考内容问题。。
  • 怎样才能把下列代码改成输出5个不一样的?
  • For循环以其主体结尾
  • 无法输出缓冲区
  • 在终端中关闭回显-Golang
  • 如何使用变量访问结构?
  • 精度的奇怪损失乘以大浮点数
  • 解析yaml结构错误
  • * url.URL类型没有字段或方法ParseRequestURI
  • syscall.MustLoadDll.MustFindProc引发“找不到指定的过程”
  • 如何将等效的GO代码转换为Java代码?
  • 强制重新下载/完全干净的环境

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华