Go: Write to a file with windows-1252 encoding

huangapple go评论75阅读模式
英文:

Go: Write to a file with windows-1252 encoding

问题

在Go语言中,可以使用特定的编码(例如windows-1252)将数据写入文件吗?

英文:

Is it possible to write to a file in Go with a specific encoding like windows-1252 for instance?

答案1

得分: 4

你需要使用一个库来进行编码之间的转换:

https://code.google.com/p/go-charset/

这个库可以让你在不同的编码之间进行字符串的转换,比如 windows-1252

英文:

You will have to use a library to convert between encodings:

https://code.google.com/p/go-charset/

The library allows you to convert strings to and from encodings like windows-1252.

答案2

得分: 2

项目go.text提供了针对这种特定情况的实用工具,其中定义了Windows-1252 charmap

英文:

Project go.text provides utilities for this precise case, with a Windows-1252 charmap defined.

huangapple
  • 本文由 发表于 2013年10月29日 00:46:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/19640478.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定