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

Pasting from terminal window into entry box includes hidden formatting which breaks parsing #103

Open
foogod opened this issue Dec 10, 2021 · 1 comment

Comments

@foogod
Copy link

foogod commented Dec 10, 2021

I was just trying to use https://mholt.github.io/json-to-go/ and found that it seemed to be unable to parse anything I was pasting into it, despite it being valid JSON. Even more strange was that it seemed to be complaining about whitespace characters being present in the input (which should be fine), but then if I typed the same thing by hand (with the same whitespace) it liked it fine. Even weirder was that if I started with a failing case, and edited out all of the whitespace, it liked it, but then if I manually inserted a space character, it broke again.

Eventually I noticed that when I cut-and-pasted JSON from a terminal window (on MacOS) into the web entry box, it was also copying over the formatting (coloring, text size, etc). However, if I used Command-Option-Shift-V to paste just the text without any formatting, lo and behold it was able to parse it just fine.

I can only assume there's something about the rich-text entrybox being used and how it returns data to the underlying code that causes weird characters to be introduced only if there is formatting involved and there are whitespace characters present.

Perhaps this should be changed to use a non-rich-text entrybox of some sort, or to filter out whatever special characters the text box itself is introducing into things?

@mholt
Copy link
Owner

mholt commented Dec 13, 2021

I noticed this too; probably some JS needed to prevent pasting of rich text (sigh): https://stackoverflow.com/questions/58980235/stop-pasting-html-style-in-a-contenteditable-div-only-paste-the-plain-text

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