Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromUTF8To ¶
FromUTF8To returns encoded text from UTF-8 text
Example ¶
package main import ( "bytes" "fmt" "io" "strings" "github.com/spiegel-im-spiegel/text/detect" "github.com/spiegel-im-spiegel/text/encode" ) func main() { utf8Text := "こんにちは,世界\n" res, err := encode.FromUTF8To(detect.ISO2022JP, strings.NewReader(utf8Text)) if err != nil { fmt.Println(err) return } buf := &bytes.Buffer{} if _, err := io.Copy(buf, res); err != nil { fmt.Println(err) return } fmt.Println(buf.Bytes()) }
Output: [27 36 66 36 51 36 115 36 75 36 65 36 79 33 36 64 36 51 38 27 40 66 10]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.