Re: query tool csv/txt output file extension choice and encoding

From: adupeyron(at)yahoo(dot)fr
To: Dave Caughey <caugheyd(at)gmail(dot)com>
Cc: richard coleman <rcoleman(dot)ascentgl(at)gmail(dot)com>, pgadmin-support(at)lists(dot)postgresql(dot)org
Subject: Re: query tool csv/txt output file extension choice and encoding
Date: 2021-02-06 09:46:22
Message-ID: ee6b4ee0-eb1f-4f10-b08d-15978152aff9@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

<div dir='auto'><span style="font-family: sans-serif; font-size: 12.8px;">It's why adding configuration parameter in pgadmin for file extension could solve the problem for most of people.</span><div dir="auto" style="font-family: sans-serif; font-size: 12.8px;">And encoding in same time would complete the feature...</div></div><div class="gmail_extra"><br><div class="gmail_quote">Le 6 févr. 2021 00:17, Dave Caughey &lt;caugheyd(at)gmail(dot)com&gt; a écrit :<br type="attribution" /><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><br /></div><div class="elided-text"><div dir="ltr">On Fri, Feb 5, 2021 at 3:39 PM richard coleman &lt;<a href="mailto:rcoleman.ascentgl&#64;gmail.com">rcoleman.ascentgl&#64;gmail.com</a>&gt; wrote:<br /></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr"><div>Dave, </div><div><br /></div><div>I concur with Alain.</div><br /><div class="elided-text"><div dir="ltr">On Fri, Feb 5, 2021 at 3:22 PM Dave Caughey &lt;<a href="mailto:caugheyd&#64;gmail.com">caugheyd&#64;gmail.com</a>&gt; wrote:<br /></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr">Always naming the file as &#34;.csv&#34;, regardless of the delimited used, was a bug that was fixed.<br /><br /></div></blockquote><div>In my case it was a bug that was created.</div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr">The problem with always naming a file as &#34;.csv&#34; is that Excel then blindly assumes that the file actually does contain comma-delimited fields, and bypasses the Import From Text Wizard, so if you use anything other than commas (e.g., you want TAB separators), then Excel won&#39;t split your file into multiple columns correctly.   Therefore, before the bug was fixed, you had to manually rename all of pgAdmin&#39;s &#34;export to file&#34; outputs to &#34;.txt&#34;.  (Exactly what you don&#39;t want to have to do, too!)<br /><br /></div></blockquote><div>No, both Alain and myself *now* have to rename the .txt files to .csv files.  In my case it&#39;s because LibreOffice won&#39;t open it in Calc with a txt extension, but instead try to open it in Write.  If I leave it .txt I have to; manually start Calc, then select the file, then try to import it.  If it&#39;s named .csv a simple double-click opens the file in Calc and in the CSV import wizard that correctly handles files delimited by comma, tab, ~, |, ;, or anything else you like.</div></div></div></blockquote><div><br /></div><div><font color="#0000ff">Yeah, that&#39;s definitely unfortunate, but I think accommodating Excel&#39;s lame behaviour far outweighs accommodating LibreOffice&#39;s lame behaviour, given the relative number of users of the two programs.</font></div><div><font color="#0000ff"><br /></font></div><div><font color="#0000ff">Clearly, this would be solvable by including a &#34;default extension&#34; (e.g., &#34;.csv&#34; or &#34;.txt&#34;) that would probably make everyone happy, but it seems that simply going back to the old buggy behaviour would be worse for a lot more people than it would help.</font></div><div><font color="#0000ff"><br /></font></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr"><div class="elided-text"><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr">Note, if your file is ends with &#34;.txt&#34;, then simply doing a &#34;File&#34; | &#34;Open&#34; in Excel will automatically/correctly invoke the Import from Text Wizard, and let you pick the delimiter you want (and it does a good job of auto-detecting).  Easy!<br /><br />And, if you don&#39;t want to use commas as your delimiter (for any number of reasons), then you can change that in pgAdmin by going to &#34;File&#34; | &#34;Preferences&#34; | &#34;CVS/TXT Output&#34; and choose your preferred delimiter (e.g., Tab, &#34;|&#34;, etc.), and thereafter that&#39;s what pgAdmin will always use when you do an &#34;export to file&#34;, but will give it an &#34;.txt&#34; extension so Excel won&#39;t screw up opening the file because it&#39;s expecting commas as delimiters.<br /><br /></div></blockquote><div>Currently the *only* options pgAdmin4 gives me are; semicolon, comma, vertical bar, or tab.  I can apparently just type whatever I want, but that&#39;s hardly obvious.  And comma is a very bad choice for European countries where sixteen hundred point fifty-two would be written as 1600,52 as opposed to 1600.52 on this side of the pond.  You might be suffering from just a touch of Americentric bias.</div><div>   </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb( 204 , 204 , 204 );padding-left:1ex"><div dir="ltr">Cheers,<br />Dave<br /><br /><br />On Fri, Feb 5, 2021 at 1:25 PM Alain Dupeyron &lt;<a href="mailto:adupeyron&#64;yahoo.fr">adupeyron&#64;yahoo.fr</a>&gt; wrote:<br />&gt;<br />&gt; Hi,<br />&gt;<br />&gt; I&#39;m using frequently the download file function in the query tool. In previous version of PgAdmin4, I select field separator &#34;;&#34;  and file was always generated with extension .csv and can be opened directly by Excel in one click with correct columns !<br />&gt;<br />&gt; Now I have always .txt extension (since 4.28 or before, I&#39;m in PgAdmin 4.29 for now) but the .txt file do not open directly in excel<br />&gt; I Have to launch excel and open it but colums are not detected in my French excel, I have to convert data...(idem with TAB separator)...fastidious !<br />&gt; Or I have to save the file from the browser, then navigate to file, then I change its extension to .csv, confirm and then the file is opened correctly...fastidious !<br />&gt;<br />&gt; When I choose field separator &#34;,&#34; in PgAdmin, then file is generated with extension .csv but colums are not detected in French Excel (comma is the decimal number separator in France...)<br />&gt;<br />&gt; &#61;&gt; How can I &#34;force&#34; or choose in Pgadmin to always generate file with extension .csv independently of selected field separator ?<br />&gt;<br />&gt;<br />&gt; 2nd point: Can we choose file encoding of generated file too ? it&#39;s in UTF-8 now (was plateform dependant in PgAdmin 3?)<br />&gt; accentuated characters are not detected corretly by french excel (expecting by default my Windows-1252 plateform encoding), I have to import file in excel and to select the right utf8 encoding in a huge encoding list...<br />&gt;<br />&gt; Other approach : copy from query result then paste in excel and save the file myself...<br />&gt; accent are ok but column header are missing, I need to select the option on each new query tab &#34;copy with header&#34; &#61;&gt; there is no pgAdmin preferences for that point ? (was in PgAdmin 3)<br />&gt;<br />&gt;<br />&gt; Yes we can blame Excel/Windows and csv format but it&#39;s the only download format proposed here  for spreadsheet tool and only theses 2-3 configurations are missing to parametrize it as expected by end user platform...<br />&gt;<br />&gt; Thanks</div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div><br></div>

Attachment Content-Type Size
unknown_filename text/html 7.3 KB

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Aditya Toshniwal 2021-02-08 04:19:26 Re: query tool csv/txt output file extension choice and encoding
Previous Message Alain Dupeyron 2021-02-05 23:32:35 Re: query tool csv/txt output file extension choice and encoding