jspreadsheet / jspreadsheet/ce

Pasting an empty column from Excel results in "\0" character being added (displayed as a white square)

Open
#1,379 2 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.