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
proposal: x/text: expose MIBenum via identifier package #47577
Comments
CC @mpvl |
In what context do you need to look up an encoding by MIBenum? |
This proposal has been added to the active column of the proposals project |
@rsc Not so much for look-up, but rather for storage - storing a number is much more compact. |
What is the exact API you are proposing? What packages would change and how? |
ping @rykov; what API are you suggesting? |
@rsc Sorry for the delay. I've prototyped the proposal in golang/text#30 |
The new API is
But identifier is an internal package. We would need to export MIB from some package (probably not all of identifier). |
@rsc Right. I'm only exporting |
It's very difficult to document those as aliases. We'd need to find some conversion back and forth to hide the existence of the internal package. Any ideas? |
@rsc I don't fully understand: are you suggesting creating two separate types to wrap the internal ones, or do you think that moving the two types out of the internal package into the public package is the better way? |
I looked some more at these packages. I think if we were going to add this API we would want to move x/text/encoding/internal/identifier to x/text/encoding/identifier first. I am not sure whether we should do that though. |
I can try exposing a minimal API via |
I am having trouble finding a way to store and look-up a specific encoding by MIBenum. It would be much more convenient and compact to have access to the MIBenum, rather than using a string name. I would like to start a discussion about exposing MIBenum via the
ID()
method forEncoding
by movingidentifier.Interface
,identifier.MIB
, out of aninternal
package, as well as exposingFindMIB
forianaindex.Index
.MIB enum is part of the IANA standard as described here:
https://www.iana.org/assignments/character-sets/character-sets.xhtml
The text was updated successfully, but these errors were encountered: