octobercms/october · error · ApplicationException
Source file encoding is not recognized. Please select the cu
Error message
Source file encoding is not recognized. Please select the custom file format option with the proper encoding to import your file.
What it means
Error "Source file encoding is not recognized. Please select the custom file format option with the proper encoding to import your file." thrown in octobercms/october.
Source
Thrown at modules/backend/behaviors/importexportcontroller/CanFormatCsv.php:32
trait CanFormatCsv
{
/**
* getImportFileColumnsFromCsv path
*/
protected function getImportFileColumnsFromCsv($path)
{
$reader = $this->createCsvReader($path);
$firstRow = $reader->fetchOne(0);
if (!post('first_row_titles')) {
array_walk($firstRow, function (&$value, $key) {
$value = 'Column #'.($key + 1);
});
}
// Prevents unfriendly error to be thrown due to bad encoding at response time.
if (json_encode($firstRow) === false) {
throw new ApplicationException(__("Source file encoding is not recognized. Please select the custom file format option with the proper encoding to import your file."));
}
return $firstRow;
}
/**
* getImportSampleColumnsFromCsv
*/
protected function getImportSampleColumnsFromCsv($path, $columnIndex)
{
$reader = $this->createCsvReader($path);
if (post('first_row_titles')) {
$reader->setHeaderOffset(0);
}
$result = (new CsvStatement)
->limit(50)View on GitHub (pinned to b608633a7e)
When it happens
Trigger: Thrown at modules/backend/behaviors/importexportcontroller/CanFormatCsv.php:32 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/81e3a771add978b1.
Report an issue: GitHub.