jspreadsheet / jspreadsheet/ce
Pasting an empty column from Excel results in "\0" character being added (displayed as a white square)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 890
- PR merge metrics
- No merged PRs in 30d
Description
I have provided my own onbeforepaste function to transform the pasted data string before it will be used in the obj.paste function of this library. However, when the pasted string goes through the obj.parseCSV(data, "\t") function it will create a two-dimensional array that contains a "\u0000" character as the final entry of this array, despite it not being present in my transformed pasted data.
I looked at the obj.parseCSV function and it looks like this happens when the last column of the last row is empty and is therefore equal to the delimiter "\t", since no value comes after it. The if-statment below will then add the '\0'.
// Last caracter is the delimiter
if (str.charCodeAt(str.length-1) == 9) {
str += "\0";
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating obj.parseCSV and the obj.paste path described in the issue, then reproduce a paste payload ending with a tab after onbeforepaste transforms it. Check the parser's trailing-delimiter handling and add or run coverage for an empty final cell. Done means the empty cell remains empty without introducing a NUL character.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100