- Go Standard Library Cookbook
- Radomír Sohlich
- 82字
- 2021-06-24 18:56:35
How it works...
The package golang.org/x/text/encoding/charmap contains the Charset type for simple encoding and decoding. The type implements the NewDecoder method that creates the Decoder structure.
Steps 1 – 5 show the use of the decoding Reader.
The encoding works analogically. The encoding Writer is created and then each string written by this Writer is encoded into Windows-1250 encoding.
Note that the Windows-1250 was chosen as an example. The package, golang.org/x/text/encoding/charmap contains a lot of other charset options.