Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading a non UTF-8 text file in Go

Tags:

People also ask

Are Golang strings UTF-8?

Some people think Go strings are always UTF-8, but they are not: only string literals are UTF-8.

Which encoding is used for go?

Package gob manages streams of gobs - binary values exchanged between an Encoder (transmitter) and a Decoder (receiver). Package hex implements hexadecimal encoding and decoding.


I need to read a text file that is encoded in GBK. The standard library in Go programming language assumes that all text is encoded in UTF-8.

How can I read files in other encodings?