Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToUTF8 ¶
ToUTF8 returns UTF-8 text from other encoding text (auto detection of encoding)
Example ¶
package main import ( "bytes" "fmt" "github.com/spiegel-im-spiegel/text/decode" ) func main() { jisText := []byte{0x1b, 0x24, 0x42, 0x24, 0x33, 0x24, 0x73, 0x24, 0x4b, 0x24, 0x41, 0x24, 0x4f, 0x40, 0x24, 0x33, 0x26, 0x1b, 0x28, 0x42} res, err := decode.ToUTF8(bytes.NewReader(jisText)) if err != nil { fmt.Println(err) return } buf := &bytes.Buffer{} if _, err := buf.ReadFrom(res); err != nil { fmt.Println(err) return } fmt.Println(buf) }
Output: こんにちは世界
func ToUTF8From ¶
ToUTF8From returns UTF-8 text from other encoding text
func ToUTF8ja ¶
ToUTF8ja returns UTF-8 text from other encoding text (auto detection of japanses encoding)
Example ¶
package main import ( "bytes" "fmt" "github.com/spiegel-im-spiegel/text/decode" ) func main() { jisText := []byte{0x1b, 0x24, 0x42, 0x24, 0x33, 0x24, 0x73, 0x24, 0x4b, 0x24, 0x41, 0x24, 0x4f, 0x40, 0x24, 0x33, 0x26, 0x1b, 0x28, 0x42} res, err := decode.ToUTF8ja(bytes.NewReader(jisText)) if err != nil { fmt.Println(err) return } buf := &bytes.Buffer{} if _, err := buf.ReadFrom(res); err != nil { fmt.Println(err) return } fmt.Println(buf) }
Output: こんにちは世界
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.