I am saving a file to the file cabinet as a csv. ...
# suitescript
a
I am saving a file to the file cabinet as a csv.
Copy code
const csvFile = file.create({
      name: `report_${dateString}.csv`,
      fileType: file.Type.CSV,
      contents: convertListToCsv(searchData),
      encoding: file.Encoding.UTF_8,
    })
I it seems the charachter
'
is getting changed to
’
Isn't the
encoding: file.Encoding.UTF_8
supposed to take care of that?
s
maybe your
convertListToCsv
isn't perfect?
if
convertListToCsv
is a function you created which creates CSV content directly, I'd strongly recommend using a library instead (e.g. papaparse) for a happy life.
a
Interesing. Papaparse looks really cool. But it doesn't seem that my issue is here is my function
convertListToCsv
as I just tested it and the data is still good at that point
s
if you think so (I wouldn't trust a convertListToCsv I wrote myself unless I had exhaustive unit testing and real world use)
e
just a note, the `N/task`module will save a search to csv in the file cabinet
a
@Shawn Talbert I definitely get your point for the bigger picture of things and will definitely give it thought, but for my specific issue I am logging it out and it looks good. But then again when I log out the getContents of the file it also looks good. Maybe it has to do with the N/email? @ehcanadian Yes. Thank you. I looked into it, but in this case if remember it didn't do exactly what was needed. (I needed it without headers and I think there were some other customizations required)
Ah! I see it the issue. It is not a
'
. It is a
message has been deleted
s
yay for typescript 🙂
a
The problem is typescript couldn't catch this one at development time, until I pasted the character from the log.debug into vscode since the data is being retrieved from a search
But yes. Yay for typescript
d
typescript is the best
c
@Azi, I'm curious to know which NPM package you are using for the NS typescript development?
a
@Charan https://www.npmjs.com/package/@hitc/netsuite-types Shoutout to @Shawn Talbert for his work on this project.
And to @darrenhillconsulting
d
@Azi, check out the contributors tab of that repo
a
I did. That's where I saw your name.
d
Oh, sorry ... I misread that whole thing. Thanks @Azi!
s
By using @ here, you have just notified all active users in this channel. Please only use @ here when absolutely necessary.