cancel
Showing results for 
Search instead for 
Did you mean: 
TonyH
Nintex Newbie

Web request creating csv files in UTF-8 without BOM

Hi there,

I am using Web Request method to create custom CSV file exports from lists. All is good and works flawlessly, except the formatting of the created file. It is saved as UTF-8 without BOM, as would people usually expect. However the problem is, that after putting this file into document library, or downloading it, neither standalone nor SP's web-based excel can read the file properly. All non-ascii characters are broken.

 

I know this problem is old as Microsoft itself. One fix is to add BOM to the file, forcing the excel recognize it is utf-8, and I did this previously just fine within completely manually created files (for example via PHP). However all my possible tries to add such leading bytes to created file via this WebRequest method failed so far, and manually editing every file is not gonna cut it for all our users at all. I was trying to use the headers options to even let it save as Windows1250, or such, but it did zero effect.

I also tried to prepare empty file just with BOM and headers to copy it and fill in the rest of stuff, but so far PUT method overwrites whole file and BOM is lost (resulting in SP nor Excel recognizing it as UTF-8), while my tries to append new lines to the file with POST failed so far as well.

 

So my question is:

A) Are we able to modify what format the file gets written to the document library? Either to include BOM, or change it to something like windows1252 so excel can open it and show all characters correctly?

B) Are we able to append new lines to existing file without touching the head of the file, thus potentially keeping the premade header with BOM? (My idea was to include "example" file and copy it with each workflow iteration and add to it, thus the header would be included) Is there some way to let WebRequest method (or other nes) to actually not overwrite but append?

C) Are we able to somehow smuggle in those three bytes? So far, all my tries in WebRequest did got encapsulated properly as a text instead of hexadecimal characters (I was trying similar trick as in PHP, trying to write escaped bytes). For newlines there is a {Common:NewLine}, is there something similar to input other control characters as this, so one can input this EF BB BF ?

 

 

 

I need to solve this within Sharepoint2013+Nintex. I included 3 questions but I feel like solving just one of them would actually be sufficient.
Thanks for anyone having any ideas.

Labels: (1)
Tags (3)
0 Kudos
Reply