example_test.go 645 B

123456789101112131415161718192021222324252627
  1. // Copyright 2015 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package ianaindex_test
  5. import (
  6. "fmt"
  7. "golang.org/x/text/encoding/charmap"
  8. "golang.org/x/text/encoding/ianaindex"
  9. )
  10. func ExampleIndex() {
  11. fmt.Println(ianaindex.MIME.Name(charmap.ISO8859_7))
  12. fmt.Println(ianaindex.IANA.Name(charmap.ISO8859_7))
  13. fmt.Println(ianaindex.MIB.Name(charmap.ISO8859_7))
  14. e, _ := ianaindex.IANA.Encoding("cp437")
  15. fmt.Println(ianaindex.IANA.Name(e))
  16. // Output:
  17. // ISO-8859-7 <nil>
  18. // ISO_8859-7:1987 <nil>
  19. // ISOLatinGreek <nil>
  20. // IBM437 <nil>
  21. }