• Resolved icqolsecretary

    (@icqolsecretary)


    Thanks for all your recent help. I have almost been able to set eme up, but I have one more question, though:

    When I try to download a csv file from the change registration page, it gives me a xls file instead.

    If I open the xls file anyway (in libreoffice) the japanese text comes out as garbage, though other text is fine. If I open it in Numbers, it tells me teh file is not a valid excel file.

    I tried using a different delimeter instead, but that didn’t work, but cant figure out how to put a tab as a delimeter.

    I renamed the file to csv and txt and opened that way in a text editor like Textedit, and the japanese is still messed up.

    I can open in Numbers/Libreoffice as a csv, and the Japanese is OK, but the file is just one long row, instead of separate rows.

    What encoding are you using? what eol marker?

    I was finally able to get it by opening it as a txt file in libreoffice, which somehow gets the japanese right, copying and pasting the text into a html table to csv converter and using the ensuing csv file.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Franky

    (@liedekef)

    I always generate csv files, but it might be that the content-type for csv-files for the booking report is wrong (currently it is “octet-stream”).
    Could you change in eme_people.php the line 115 from
    header("Content-type: application/octet-stream");
    to
    header("Content-type: text/csv");
    and try again?

    Thread Starter icqolsecretary

    (@icqolsecretary)

    I tried a few variations but none worked. I thought it would be a chrome problem, but i got the same error in Opera. Haven’t tried firefox…

    I notice that the file is downloading as “download.xls” not as export, for some reason.

    Online I found a suggestion to add a content transfer encoding line as below. Didn’t help. I also tried to use single quotes to avoid escaping the double quotes. I also tried without the quotes around the filename altogether. All downloaded as download.xls, and still the same problem. The output file does not have the line breaks, etc.

    When I download the file a new table opens and I can read the first few characters of the url as “data:application/vnd.ms-excel;base64” plus lots of random letters.

    header("Content-type: application/octet-stream");
    header("Content-Transfer-Encoding: UTF-8");
    header('Content-Disposition: attachment; filename="export.csv"');

    I hope that helps you troubleshoot. It could be a problem on my end, of course, but I have no clue to even know where to look. I looked at my extensions to see if they were a problem, but I didn’t see any obvious candidates.

    • This reply was modified 9 years, 2 months ago by icqolsecretary. Reason: fix code
    Thread Starter icqolsecretary

    (@icqolsecretary)

    FYI
    “new table opens and I can read the first few characters of the url ” should read “new tab opens up in chrome…”, not table….

    I tried safari. it saves as “Unknown” (no extension), but file broken as before (no new lines, bad japanese)

    Plugin Author Franky

    (@liedekef)

    Ho, I see …
    you’re not clicking on the “CSV export” link but on the “CSV” button. The difference is that the CSV button is in fact javascript-gnerated output (just html in fact) that for example libreoffice can read just fine.
    If you want a CSV-export of the bookings for one event, click on the link “CSV export” (in Excel, “Text to columns” might be needed).
    If you want to debug the javascript html-export, check js/eme_admin.js (search for “vnd.ms-excel”). The reason that doesn’t work is because it is doing base64-export I guess, but I haven’t found a better way of doing table-csv exports yet. But the “CSV export” link should work just fine.

    Thread Starter icqolsecretary

    (@icqolsecretary)

    Well, I see what is happening now, but it is way out of my league. The csv export appears to be working, as you said, so I will make do with that for now.

    Libreoffice is able to open the file, but all the rows become one row. I had to use the html converter to get the rows working.

    Anyway, I do appreciate the effort and time. Thank you sincerely.

    D

    Plugin Author Franky

    (@liedekef)

    In the end it is a html table that is being presented to libreoffice, so it should work just fine (even if – when you open it in a text editor – it is all on 1 line).
    I tried putting chinese characters in my installation and the CSV button works just fine … if you want, I can email you a different version of eme_admin.js to test (optionally)

    Thread Starter icqolsecretary

    (@icqolsecretary)

    GOT IT!!!

    (I think) the bug is in my libreoffice html importer which assumes files are in western latin1.

    If I change the extension to html, open in libreoffice, copy paste the ensuing table in calc, all is well. I can export to csv and this continues to work when reopened. Circle Squared.

    Thank you so much. I am sorry it turned out to be a problem on my end, but I couldn’t have troubleshot (shooted?) without your kind help. I am a happy camper. 🙂

    Thread Starter icqolsecretary

    (@icqolsecretary)

    For future reference:
    https://neowiki.neooffice.org/index.php/Importing_HTML_Tables_into_a_Calc_Document

    this is for neoffice, but it seems to apply, and the solution works…

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘csv files’ is closed to new replies.