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

Using idna codec #128

Closed
j-bernard opened this issue Sep 14, 2022 · 2 comments · Fixed by #145
Closed

Using idna codec #128

j-bernard opened this issue Sep 14, 2022 · 2 comments · Fixed by #145

Comments

@j-bernard
Copy link
Contributor

As per the documentation I tried using idna codec but it still uses the one from encodings.idna.

>>> import idna.codec
>>> codecs.encode('fuß', 'idna')
b'fuss'
>>> codecs.getencoder('idna')
<bound method Codec.encode of <encodings.idna.Codec object at 0x7ff6eb158fa0>>

I also tried registering the codec with idna.codec.getregentry with the same result. Am I missing something here?

@kjd
Copy link
Owner

kjd commented Nov 1, 2022

I haven't found an obvious way to do this, but it probably requires more investigation as to whether it is possible to override an internal codec. In the meantime I can register an encoder with the name 'idna2008' without problem, maybe that is a compromise approach.

kjd added a commit that referenced this issue Nov 1, 2022
Register 'idna2008' codec (issue #128)
@j-bernard
Copy link
Contributor Author

I took some time to investigate and did not find a way to make it work either. Thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants