CSV Buffer encoding trick

So I am reading some Amazon files with the CSV Buffer and I keep seeing strange characters in Spanish or French names. Hm. Thought encoding problems are a thing of the past. I play with importing the file into Excel with the various encodings until it turns out the characters display best with UTF-8. Which is to be expected, most popular encoding these days.

Looking into the CSV Buffer table, I see in InitializeReader Encoding.Default instead of Encoding.UTF8. That was the culprit. My solution was to copy this function and the LoadData that calls it into new functions and make encoding choosable by a parameter to LoadData's copied version.


  • txerifftxeriff Member Posts: 480
    edited 2019-05-30

    I´m not sure if CSV buffer table is something new, I only know table 370, excel buffer.

    For importing CSV files I would suggest:

    -Open with notepad (click view>status bar) or notepad++ and check the enconding. As you´ve said UTF8 works best. If it is something else, I´ve found you this old function (https://mibuso.com/downloads/ansi-ascii-converter)
    -Create a xmlport for imports. set enconding UTF8. You can find many examples in xml ports, try find something like "import" and use that one as template.
    -You can use this also, it is very usefull when you have like 30 fields to import, helps a lot https://mibuso.com/downloads/dynamics-nav-xmlport-generator-v1.3
    -i usually like to set autoinsert and autpupdate properties off. I do all by myself in beforeimport trigger.

    hope this helps.

  • Miklos_HollenderMiklos_Hollender Member Posts: 1,597
    CSV Buffer table completely sucks because it does not care about quotation marks. That is, it does not recognize that "Paris, France" is one field, not two fields. Have to rewrite my whole import as an XMLPort.
Sign In or Register to comment.