Re: [GNC-dev] gnucash stable: Bug 799121 - Parse error on CSV import on MacOS

2023-11-17 Thread john
Good idea, thanks.

Regards,
John Ralls


> On Nov 16, 2023, at 23:14, Geert Janssens  wrote:
> 
> 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:
> > Updatedvia  https://github.com/Gnucash/gnucash/commit/102304b3 (commit)
> > from  https://github.com/Gnucash/gnucash/commit/8d993e73 (commit)
> >
> >
> >
> > commit 102304b38b153a5b87280da88d0679663eec2e1f
> > Author: John Ralls 
> > 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 
> >  #include 
> > +#include 
> >  #include 
> >
> >  #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-chan...@gnucash.org
> > https://lists.gnucash.org/mailman/listinfo/gnucash-changes
> 
> 

___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel


Re: [GNC-dev] gnucash stable: Bug 799121 - Parse error on CSV import on MacOS

2023-11-16 Thread Geert Janssens
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:
> Updatedvia  https://github.com/Gnucash/gnucash/commit/102304b3 
> (commit)
>   from  https://github.com/Gnucash/gnucash/commit/8d993e73 (commit)
> 
> 
> 
> commit 102304b38b153a5b87280da88d0679663eec2e1f
> Author: John Ralls 
> 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 
>  #include 
> +#include 
>  #include 
> 
>  #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-chan...@gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-changes


___
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel