{"record":{"id":"81e3a771add978b1","repo":"octobercms/october","slug":"source-file-encoding-is-not-recognized-please-sel","errorCode":null,"errorMessage":"Source file encoding is not recognized. Please select the custom file format option with the proper encoding to import your file.","messagePattern":"Source file encoding is not recognized\\. Please select the custom file format option with the proper encoding to import your file\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/backend/behaviors/importexportcontroller/CanFormatCsv.php","lineNumber":32,"sourceCode":"trait CanFormatCsv\n{\n    /**\n     * getImportFileColumnsFromCsv path\n     */\n    protected function getImportFileColumnsFromCsv($path)\n    {\n        $reader = $this->createCsvReader($path);\n        $firstRow = $reader->fetchOne(0);\n\n        if (!post('first_row_titles')) {\n            array_walk($firstRow, function (&$value, $key) {\n                $value = 'Column #'.($key + 1);\n            });\n        }\n\n        // Prevents unfriendly error to be thrown due to bad encoding at response time.\n        if (json_encode($firstRow) === false) {\n            throw new ApplicationException(__(\"Source file encoding is not recognized. Please select the custom file format option with the proper encoding to import your file.\"));\n        }\n\n        return $firstRow;\n    }\n\n    /**\n     * getImportSampleColumnsFromCsv\n     */\n    protected function getImportSampleColumnsFromCsv($path, $columnIndex)\n    {\n        $reader = $this->createCsvReader($path);\n\n        if (post('first_row_titles')) {\n            $reader->setHeaderOffset(0);\n        }\n\n        $result = (new CsvStatement)\n            ->limit(50)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/behaviors/importexportcontroller/CanFormatCsv.php#L14-L50","documentation":"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.","triggerScenarios":"Thrown at modules/backend/behaviors/importexportcontroller/CanFormatCsv.php:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}