Is it possible to set an encoding for a file that is uploaded via a VisualForce page? I am getting errors stating that the content of the uploaded file is not UTF-8 encoded. Ideally, the user would be able to specify the file encoding himself, similar to the Account and Contact import wizard.
Assuming your CSV file is being processed by a VF controller as part of a binding from the
apex:inputFile component to a controller variable of type Blob, then, if you want to manipulate the CSV contents in the controller, the Blob must be converted to a String using Blob instance method
toString() method requires that the Blob contain only UTF-8 characters as all Apex string operations are done in UTF-8.
Conclusion, the uploaded file when presented to the VF page has to be in UTF-8 before the page action executes.