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.
5
// Package ianaindex maps names to Encodings as specified by the IANA registry.
6
// This includes both the MIME and IANA names.
8
// See http://www.iana.org/assignments/character-sets/character-sets.xhtml for
13
"launchpad.net/account-polld/plugins/imap/text/encoding"
16
// TODO: allow users to specify their own aliases?
17
// TODO: allow users to specify their own indexes?
18
// TODO: allow canonicalizing names
20
// NOTE: only use these top-level variables if we can get the linker to drop
21
// the indexes when they are not used. Make them a function or perhaps only
22
// support MIME otherwise.
25
// MIME is an index to map MIME names. It does not support aliases.
28
// IANA is an index that supports all names and aliases using IANA names as
29
// the canonical identifier.
33
// Index maps names registered by IANA to Encodings.
37
// Get returns an Encoding for IANA-registered names. Matching is
39
func (x *Index) Get(name string) (encoding.Encoding, error) {
40
panic("TODO: implement")
43
// Name reports the canonical name of the given Encoding. It will return an
44
// error if the e is not associated with a known encoding scheme.
45
func (x *Index) Name(e encoding.Encoding) (string, error) {
46
panic("TODO: implement")
49
// TODO: the coverage of this index is rather spotty. Allowing users to set
50
// encodings would allow:
51
// - users to increase coverage
52
// - allow a partially loaded set of encodings in case the user doesn't need to
54
// - write an OS-specific wrapper for supported encodings and set them.
55
// The exact definition of Set depends a bit on if and how we want to let users
56
// write their own Encoding implementations. Also, it is not possible yet to
57
// only partially load the encodings without doing some refactoring. Until this
58
// is solved, we might as well not support Set.
59
// // Set sets the e to be used for the encoding scheme identified by name. Only
60
// // canonical names may be used. An empty name assigns e to its internally
61
// // associated encoding scheme.
62
// func (x *Index) Set(name string, e encoding.Encoding) error {
63
// panic("TODO: implement")