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
SF Admin.HRGSF Admin.HRG 

Visualforce CSV file export encoding issue

Hi

Issue is that certain symbols/letters appear broken on the CSV file that has been exported, as by default the encoding is ISO-8859-1.
However forcing it to export in UTF-8 seems to have zero effect - meaning the exported file will still have broken symbols, even though the symbols/letters are displayed correctly in SF itself.

The export function VS page code piece is like this :
 
<apex:page controller="TestPage" cache="true" contentType="text/csv#filename.csv; charset=UTF-8">

Tried the solutions offered in ..

https://developer.salesforce.com/forums/?id=906F0000000962nIAA
http://salesforce.stackexchange.com/questions/16157/attachment-utf-8-character-set
http://salesforce.stackexchange.com/questions/18546/unable-to-display-utf-8-character-in-a-csv-file-generated-from-apex-code
 
Best Answer chosen by SF Admin.HRG
Richard Jimenez 9Richard Jimenez 9
Hi,

Can you confirm that you tried the VF below (as suggested in the first article) ?

<apex:page controller="TestPageController" cache="true" contentType="text/csv#filename.csv" showheader="false">
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>

Or, you may be able to use Notepad++ to convert the encoding?

Thanks,
Richard.
 

All Answers

Richard Jimenez 9Richard Jimenez 9
Hi,

Can you confirm that you tried the VF below (as suggested in the first article) ?

<apex:page controller="TestPageController" cache="true" contentType="text/csv#filename.csv" showheader="false">
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>

Or, you may be able to use Notepad++ to convert the encoding?

Thanks,
Richard.
 
This was selected as the best answer
SF Admin.HRGSF Admin.HRG
Hi

Yes, by adding that code piece the encoding issue remains and the header code is actually displayed in the exported list. Attached image.

ExcelResult

As for the conversion - while that works even with regular Notepad, it isn't a practise we can use, due to the amount of time it would go for this. We'll need to force the UTF-8 encoding for the original file.

Thanks
BoothleadsBoothleads
For me this is the issue ,could anyone please reply how to resolve this issue and how to include charset=UTF-8 in CSV generated from visualforce page?