function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ales.pales.p 

Csv attachment with line feed and carriage return

I'm trying to build an Apex Class that:

1 - upsert some records

2 - create an attachment

3 - send an email with that attachment

 

All works well but only one thing is wrong and I'm not able to understand how to solve.

Each line of CSV file MUST contain as required CHR(13) and CHR(10) characters and I insert '\r\n' to obtain that.

 

But when I check the end of each CSV line, the file contains a double:

CHR(10) CHR(10)

...instead of

CHR(13) CHR(10)

...as expected.

 

It seems that '\r' OR '\n' has been converted both to CHR(10). :smileysad:

 

Any help?

Thanks in advance...

 

ales.pales.p

Maybe we could try with Hex values but is there a way to convert Hex values to String?