[GNC-dev] gnucash stable: Bug 799121 - Parse error on CSV import on MacOS
Geert Janssens
geert.gnucash at kobaltwit.be
Fri Nov 17 02:14:07 EST 2023
Good find!
You may want to do the same in CsvImpPriceAssist::preview_refresh. It's following the
exact same coding semantics as CsvImpTransAssist.
Regards,
Geert
Op vrijdag 17 november 2023 05:30:38 CET schreef John Ralls:
> Updated via https://github.com/Gnucash/gnucash/commit/102304b3 (commit)
> from https://github.com/Gnucash/gnucash/commit/8d993e73 (commit)
>
>
>
> commit 102304b38b153a5b87280da88d0679663eec2e1f
> Author: John Ralls <jralls at ceridwen.us>
> Date: Thu Nov 16 18:15:17 2023 -0800
>
> Bug 799121 - Parse error on CSV import on MacOS
>
> Use csv_tximp_preview_sep_button_cb solely as a callback, its error
> handling doesn't make sense otherwise. All we want at the end of
> preview_refresh is to attempt a tokenize.
>
> In addition to not going into an infinite loop with the message box
> this presents a more helpful message suggesting that the encoding is
> wrong.
>
> diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
> b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp index
> 55823b93b1..d1cb2480ea 100644
> --- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
> +++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
> @@ -34,6 +34,7 @@
>
> #include <gtk/gtk.h>
> #include <glib/gi18n.h>
> +#include <stdexcept>
> #include <stdlib.h>
>
> #include "gnc-path.h"
> @@ -1726,7 +1727,14 @@ CsvImpTransAssist::preview_refresh ()
> gtk_entry_set_text (GTK_ENTRY(custom_entry), separators.c_str());
> g_signal_handlers_unblock_by_func (custom_cbutton, (gpointer)
> csv_tximp_preview_sep_button_cb, this); g_signal_handlers_unblock_by_func
> (custom_entry, (gpointer) csv_tximp_preview_sep_button_cb, this); -
> csv_tximp_preview_sep_button_cb (GTK_WIDGET (custom_cbutton), this); +
> try
> + {
> + tx_imp->tokenize (false);
> + }
> + catch(std::range_error& err)
> + {
> + PERR("CSV Tokenization Failed: %s", err.what());
> + }
> }
>
> // Repopulate the parsed data table
>
>
>
> Summary of changes:
> gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp | 10
> +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
>
> _______________________________________________
> gnucash-changes mailing list
> gnucash-changes at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-changes
More information about the gnucash-devel
mailing list