03-09-2020, 02:53 AM
(03-08-2020, 05:09 PM)Zubersoft Wrote: I would leave the file in UTF-8 encoding to ensure compatibility. Leading zeroes is fine - my code should strip those when it parses out the integer values. If you would like me to send you the CSV file I just created that works so you can test with it, I'm happy to do that.I've solved my simple Title;Pages only CSV import by playing around with encoding and BOM. I've achieved success with 2 different CSV export settings from my database: (1) declaring NO encoding; and (2) declaring ISO-8859-1 coding. I've examined both resulting files in a hex editor and they are free of BOM.
With the Windows 10 version, if you import a csv file that is outside of the MobileSheets storage location, it will prompt you to pick the PDF that goes with that CSV file. If you import a csv file that is inside the MobileSheets storage location, it will look for a matching PDF for that csv file and will automatically use it if one is found.
Mike
By contrast, every other encoding I tested (INCLUDING requested UTF-8 or UTF-16) resulted in a BOM (EF BB BF for UTF-8 or FF FE for UTF-16); no file with a BOM of any kind was accepted by MSP.
From my own readings, "UTF-8" can be with or without its identifying BOM or with it as the 1st 3 bytes of a text file (EF BB BF). I've been experimenting and my .CSV exporting software exports a .CSV with the BOM when UTF-8 is requested. By contrast, when ISO-8859-1 is requested, the .CSV has no BOM and if I fail to request any particular encoding, the same result. From what I read, UTF-8 encoding WITHOUT the BOM is often necessary not to confuse "older" software. Ouch! So you might want to consider adding to the Win10 manual that the user should ensure that any CSV file used for import does NOT have a BOM; specifiying UTF-8, without more, is apparently not good enough and, in fact, specifying ISO-8859-1 produces a better result. Or, of course, you could programatically strip any BOM before parsing the text--might prevent insanity infecting users with no idea what a BOM is or how they got one!
Now I need to find out what else is wrong, if anything, with my larger CSV with lots of columns and lots of rows. Are there ANY MSP fields or groups that are not now eligible for CSV Import? Is the Win10 manual still up-to-date about the allowable import fields? Thanks again.
- Kevin