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

Better document the behavior of decoding functions with respect to the BOM #89

Closed
dralley opened this issue Sep 23, 2022 · 1 comment
Closed

Comments

@dralley
Copy link

dralley commented Sep 23, 2022

As described on #88:

  • decode() changes the encoding that's used according to the BOM and removes the BOM.
  • decode_with_bom_removal() removes the (leading) BOM if it matches the BOM for the encoding but doesn't change the encoding.
  • decode_without_bom_handling() gives no special treatment to the BOM.

The naming implies that the difference between decode() and decode_with_bom_removal() is that the latter removes the BOM whereas the former presumably would not. This isn't the case - both remove the bom, but decode() performs BOM sniffing whereas decode_with_bom_removal() does not, and that is the primary distinguishing feature between the two.

The documentation and perhaps naming of the functions could be improved to better reflect this (also applies to the streaming API - the decoder constructors of matching names).

@hsivonen
Copy link
Owner

Improved the docs. Thanks.

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

No branches or pull requests

2 participants