Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text: ianaindex returns no encoding for gb2312 #24636

Open
crawshaw opened this issue Apr 2, 2018 · 1 comment
Open

x/text: ianaindex returns no encoding for gb2312 #24636

crawshaw opened this issue Apr 2, 2018 · 1 comment
Labels
Milestone

Comments

@crawshaw
Copy link
Contributor

@crawshaw crawshaw commented Apr 2, 2018

Using the golang.org/x/text/encoding/ianaindex package.

        encoding, err := ianaindex.MIME.Encoding("gb2312")
        fmt.Println(encoding, err) // prints <nil> <nil>

I believe it should be returning simplifiedchinese.HZBG2312.

cc @mpvl

@gopherbot gopherbot added this to the Unreleased milestone Apr 2, 2018
@bcmills bcmills added the NeedsFix label Apr 2, 2018
@meirf

This comment has been minimized.

Copy link
Contributor

@meirf meirf commented Jun 18, 2018

This specific behavior has been around since Encoding was added.

To fix this particular example, would probably just need an entry:
enc2025: simplifiedchinese.HZGB2312,
Though I wonder if there's a way to generate the encodings from a public source.

The code has this:

// TODO: the coverage of this index is rather spotty. Allowing users to set
// encodings would allow:
// - users to increase coverage
// - allow a partially loaded set of encodings in case the user doesn't need to
//   them all.
// - write an OS-specific wrapper for supported encodings and set them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.