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

text/plain does not cover text/plain;charset=utf8 #143

Open
RuijieYu opened this issue Jul 4, 2022 · 1 comment
Open

text/plain does not cover text/plain;charset=utf8 #143

RuijieYu opened this issue Jul 4, 2022 · 1 comment

Comments

@RuijieYu
Copy link

RuijieYu commented Jul 4, 2022

I noticed that when the copied content is of MIME type text/plain;charset=utf-8, I cannot paste using MIME type text/plain, yet I can paste using MIME type text. Is this an intended behavior?

As an example:

$ paste_test() { wl-paste -l; wl-paste -t "$1" 2>/dev/null | wc -c; }
$ paste_test text/plain
text/plain;charset=utf-8
UTF8_STRING
0
$ paste_test 'text/plain;charset=utf-8'
text/plain;charset=utf-8
UTF8_STRING
7

In contrast, I can paste with MIME type text:

$ paste_test text
text/plain;charset=utf-8
UTF8_STRING
7

Edit: the content was copied from a terminal window (alacritty), which only offers the two MIME types as shown above.
Edit 2: I think this tangentially relates to #71, and I am curious why this snippet has no effect on my scenario.

@YaLTeR
Copy link
Collaborator

YaLTeR commented Jul 5, 2022

Yeah, this is kind of intentional. There's a check in the code for the text MIME type, in which case it tries a few text-like types. I can see it useful to enable this check for text/plain as well, however, I don't remember what the original reasoning was for not doing that, and whether there was an original reasoning in the first place. For what it's worth, in my wl-clipboard-rs I'm pretty sure this behavior is the same as the current in wl-clipboard, from a quick glance at the code.

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