Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 16, 2022. It is now read-only.
This repository was archived by the owner on Jul 16, 2022. It is now read-only.

Choice of encoding? #56

@oprypin

Description

@oprypin

The documentation says that the lib opens files in 'w' mode (which is text). I don't see any mention of the encoding, though. Not only is there no explicit default, there isn't even a documented way to choose an encoding. After a long look I finally found a trail showing that one can, in fact, pass the encoding parameter: the passthrough atomic_write(**cls_kwargs)AtomicWriter(**open_kwargs) (the latter never mentioned).

The problem with that? Well, most people will probably assume it's UTF-8, but instead it seems to be getdefaultencoding (not even sure, it's hard to find). It seems like that will help to perpetuate the problems described at https://www.python.org/dev/peps/pep-0597/#using-the-default-encoding-is-a-common-mistake
So there are 2 (3?) issues I see:

  • The default encoding is implicit.
    • It's not documented that it's implicit.
  • A way to choose an encoding is not shown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions