Step 1: Copy some text from excel Step 2: Paste into the description field of transaction Results : Newline (char(10) is inserted into the end of the string 1. Sqlite database shown char(10) is inserted 2. Reconcile windows shown the transaction is newlined 3. if export the transaction to CSV, extra newline is shown in the CSV file.
Created attachment 372918 [details] reconcile windows
*** Bug 796760 has been marked as a duplicate of this bug. ***
Comment on attachment 372918 [details] reconcile windows What has this got to do with pasting from Excel?
Ah, never mind, I didn't get the whole picture the first time. FWIW this is also the case for cells pasted from libreoffice if one selects the whole cell, copies, and pastes... into emacs, or a shell window, or ... The point being that the spreadsheet is putting the CR in the clipboard, GnuCash isn't adding it. GnuCash is working as it should.
(In reply to John Ralls from comment #3) > Comment on attachment 372918 [details] > reconcile windows > > What has this got to do with pasting from Excel? The lower part of the funds out section shown that there is 2 line for each transaction. (Upper part transaction is not copy 7 paste from excel. so it is one line only)
(In reply to John Ralls from comment #4) > Ah, never mind, I didn't get the whole picture the first time. > > FWIW this is also the case for cells pasted from libreoffice if one selects > the whole cell, copies, and pastes... into emacs, or a shell window, or ... > The point being that the spreadsheet is putting the CR in the clipboard, > GnuCash isn't adding it. GnuCash is working as it should. It will cause some problem if export the transaction to CSV, the format of the CSV will be corrupted ...
So don't copy whole cell, double click on it and select only what you want to copy. Computers rather famously do what you tell them, not what you want. It's up to you to make sure that what you say and what you want are the same thing.
(In reply to John Ralls from comment #7) > So don't copy whole cell, double click on it and select only what you want > to copy. Computers rather famously do what you tell them, not what you want. > It's up to you to make sure that what you say and what you want are the same > thing. I understand that there is workaround for this issues. However, in my case, the content of the cell is a format (say, =concatenate(A cell ,B cell )), it is not able to use the workaround above (Of course, it can can copy to other column and paste as text, and then paste to Gnucash ...) Anyway, Thank you for support.
(In reply to Alex Mak from comment #8) > (In reply to John Ralls from comment #7) > > So don't copy whole cell, double click on it and select only what you want > > to copy. Computers rather famously do what you tell them, not what you want. > > It's up to you to make sure that what you say and what you want are the same > > thing. > > I understand that there is workaround for this issues. However, in my case, > the content of the cell is a format (say, =concatenate(A cell ,B cell )), it > is not able to use the workaround above (Of course, it can can copy to other > column and paste as text, and then paste to Gnucash ...) > > Anyway, Thank you for support. Typo ... formula
If there's a bug it's in the spreadsheets, not in GnuCash. There's no way for GnuCash to magically know that you don't want part of the clipboard pasted in.
(In reply to John Ralls from comment #10) > If there's a bug it's in the spreadsheets, not in GnuCash. There's no way > for GnuCash to magically know that you don't want part of the clipboard > pasted in. Understand, thank a lot.
(In reply to John Ralls from comment #10) > If there's a bug it's in the spreadsheets, not in GnuCash. There's no way > for GnuCash to magically know that you don't want part of the clipboard > pasted in. Yes and no. Gnucash *can* parse out what it can't handle (or what's not wanted). I agree with Alex having a newline in a description field is unwanted and you won't be able to type it in directly. If some text pasted in does contain such a character we can omit it or replace it with a suitable replacement that does work in our registers (like a space character). That's a far better user experience than pasting with newlines. (In reply to Alex Mak from comment #6) > It will cause some problem if export the transaction to CSV, the format of > the CSV will be corrupted ... While I agree with you we should be sanitize text we receive from the clipboard this is irrelevant for the export issue you mention here. A csv file can have newlines if the fields are quoted and the gnucash csv exporter has an option to add them. If the program you use to import a gnucash csv file can't handle that, that would indeed be an issue of that program, not gnucash.
> Gnucash *can* parse out what it can't handle (or what's not wanted). Not easily: gnc_item_edit_paste_clipboard (GncItemEdit *item_edit) { gtk_editable_paste_clipboard(GTK_EDITABLE(item_edit->editor)); } Gtk does expose API for manipulating the clipboard, https://developer.gnome.org/gtk3/stable/gtk3-Clipboards.html, but it can get pretty hairy, especially dealing with multiple platforms. Probably better to do the paste and then work with the GncItemEdit's buffer to remove all of the control characters (0x00-0x1f, 0x7f-0x9f).
*** Bug 797116 has been marked as a duplicate of this bug. ***