CSV imports keep accented letters: csvTextToUtf8 reads an upload as UTF-8 whether it was saved as UTF-8, UTF-16, Windows-1252 or Mac Roman, used by every import window kind, bank statements on Expenses and Income, and the network IP and interface imports; tab separated files import; the import answer survives a bad byte; 26.12.6 changelog and CONTRIBUTING rule

This commit is contained in:
johnnyq
2026-12-04 11:55:35 -05:00
parent 76c572c67e
commit c4e486a652
7 changed files with 92 additions and 18 deletions

View File

@@ -351,7 +351,10 @@ if (isset($_POST['import_client_asset_interfaces_csv'])) {
redirect();
}
$file = fopen($_FILES['file']['tmp_name'], 'r');
// As UTF-8 whatever the spreadsheet saved it as
$file = fopen('php://temp', 'r+');
fwrite($file, csvTextToUtf8((string) @file_get_contents($_FILES['file']['tmp_name'])));
rewind($file);
$header = fgetcsv($file, 1000, ',');
if (!is_array($header) || !in_array(count($header), [8, 9], true)) {
fclose($file);