Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bo Jacobsen 606 posts 2404 karma points
    Sep 20, 2021 @ 13:34
    Bo Jacobsen
    0

    Export csv file encoding

    Hi Matt.

    We have an issue with Æ, Ø and Å in Danish, when exporting the csv file in VENDR 1.8.6

    So my question is, if its possible to add System.Text.Encoding.UTF8 to the export function?

    I have tried to add it to the response in the cshtml view:

    Response.Charset = "utf-8";
    Response.ContentEncoding = System.Text.Encoding.UTF8;
    Response.HeaderEncoding = System.Text.Encoding.UTF8;
    

    I also tried to add ;charset=UTF-8 to the mime type: enter image description here

    If its not possible in any way now, then my suggestion would be to include it this way in the future: enter image description here

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 20, 2021 @ 15:28
    Matt Brailsford
    0

    Hi Bo,

    Hmm, the file encoding should already be UTF-8 encoded as that's basically what we do internally.

    The only thing that is related to culture when it comes to rendering is the UI culture of template at point of render, which generally uses the language culture you select in the export dialog.

    🤔

    PS Where are you special characters? In the data that is being rendered? are hard coded in the templates? or both?

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 21, 2021 @ 07:41
    Bo Jacobsen
    0

    Hi Matt.

    I have tried with Danish, English and culture not selected.

    We are using these special charecters in the header the places where we are using amount (beløb) and we are gettin it as data from the order, like the city Næstved. So the short answer is both :)

    Is there a way i somehow can test your code for '/umbraco/backoffice/vendr/vendrexport/export' to see if i can fix it?

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 21, 2021 @ 07:52
    Matt Brailsford
    0

    Actually, do you want to try opening the template files in a code editor and check the files formatting? I think it could be this that is the issue. I just tested a local file and it was UTF8 with BOM and I think it's the BOM that is the issue. If you re-save the file as just UTF8 does that fix the issue?

    Matt

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 21, 2021 @ 09:59
    Bo Jacobsen
    0

    Actuelly. When i open the .csv file in notepad++, it works. But when i open it in Excel it does not work.

    When i then save as, in Excel and choose a new .csv utf8 format, it does not change anything, except that when i now open it in notepad++, then it does no longer works there.

    However if i make a new document in notepad++ as UTF-8 Without BOM and paste the data in and save it and create it as a new .csv file. Then it works in both notepad++ and Excel.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 21, 2021 @ 10:10
    Matt Brailsford
    0

    Hi Bo, when I mentioned template, I meant the razor cshtml template file for the export. I think it might be this that is stored as UTF8 with BOM and is what is influencing the output.

    If you open the template file and resave it as just UTF8, is the export output csv file just UTF8 too (without BOM)?

    Matt

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 21, 2021 @ 10:40
    Bo Jacobsen
    0

    I misunderstood then.

    I have now tried to resave it with UTF-8 and without BOM and its still the same.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Sep 21, 2021 @ 10:49
    Matt Brailsford
    0

    Ok, interesting.

    I'll have to try and look at what's going on then and run some tests 🤔

    Matt

  • Bo Jacobsen 606 posts 2404 karma points
    Sep 22, 2021 @ 09:27
    Bo Jacobsen
    0

    I appreciate that :)

Please Sign in or register to post replies

Write your reply to:

Draft