Skip to content

ENH: deprecate reading from clipboard only supports utf-8 encoding #57191

Open
@PaleNeutron

Description

@PaleNeutron

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

Code following will raise NotImplementedError: reading from clipboard only supports utf-8 encoding

df = pd.read_clipboard(encoding="gbk")

BUT, if user do it with:

pd.io.clipboard.ENCODING = "gbk"
df = pd.read_clipboard()
pd.io.clipboard.ENCODING = "utf8"

It works well.

Feature Description

I am not sure why encoding in pandas is fixed to 'utf8', but in wsl2 user's windows system default encoding is usually not Unicode and very hard to migrate this settings.

Allow user change encoding of read_clipboard will be very helpful.

Alternative Solutions

pd.io.clipboard.ENCODING = "gbk"
df = pd.read_clipboard()
pd.io.clipboard.ENCODING = "utf8"

Additional Context

data for testting:

1
2
3
4
5
# stdout[:-2]
data = b'\xd5\xe2\t1\r\n\xca\xc7\t2\r\n\xd2\xbb\t3\r\n\xb8\xf6\t4\r\n\xb1\xed\t5\r\n'

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO DataIO issues that don't fit into a more specific labelNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions