You need to sign in to do that
Don't have an account?
Shweta Garg
Problem in displaying Japanese or bold character in the CSV file inside ZIP file
Hello,
I have a requirement to send ZIP file containing multiple CSV files.I am using Zippes library to cerate ZIP file in apex.
Here is the code.
Is there any way to define the file type of CSV file inside ZIP file ?How can we display japanese or bold charcaters properly in th CSV file inside ZIP ?Please help.
Thanks in advance.
I have a requirement to send ZIP file containing multiple CSV files.I am using Zippes library to cerate ZIP file in apex.
Here is the code.
Blob exceldata; Zippex sampleZip = new Zippex(); sampleZip.addFile('rooms.csv', exceldata, null); Blob zipBlob = sampleZip.getZipArchive(); Document newdoc = new Document(); newdoc.Name = 'Roomtest'+'.zip'; newdoc.FolderId = UserInfo.getUserId(); newdoc.Body = zipBlob; newdoc.ContentType = 'application/x-zip-compressed;charset=UTF-8'; insert newdoc;This rooms.csv file contains some bold charcters and Japanese charcters .But When I downloaded the document ,bold and japanese charcters are not showing properly.
Is there any way to define the file type of CSV file inside ZIP file ?How can we display japanese or bold charcaters properly in th CSV file inside ZIP ?Please help.
Thanks in advance.
you need to save your CSV file with UniCode(UTF-8) format. from your code i think your creating ZIP file and defining type as zip and encoding that ZIP file not for that CSV file already there in the ZIP file.
if CSV file manually created try below method to encode CSV and add it to ZIP folder.
While do the save as option for CSV,
Hope this will helps you to keep the CSV document in original format.
Thanks
karthik
Thank you so much for the reply.
But that is problem .I wanted to define the file type(text/html;charset=UTF-8) for CSV file which I am adding in ZIP file.But there is no option to define File type in this method(sampleZip.addFile('rooms.csv', exceldata, null);).
Here I am using ZIPPEX library to cerate ZIP file.
https://github.com/pdalcol/Zippex
Regards,
Shweta
Try below code, i hope it will work, just give a try.. i just added exceldata.toString().
i refered below link
https://salesforce.stackexchange.com/questions/12336/upload-csv-in-different-encoding-than-utf-8
Thanks
karthik
Here is the syntax for addfile method in the ZIPPEX library.
public void addFile(String fileName, Blob fileData, String crc32)
File data must be in Blob.It will not accept String .
Morever,if I open the ZIP file using ZIP Extrcator of google drive then it is working fine.
Thanks,
Shweta