From dd40d23d714b727456fc4138bbacd3e16b5f89c5 Mon Sep 17 00:00:00 2001 From: Alex <40072887+alexdcrane@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:05:05 -0700 Subject: [PATCH] Convert encoding type to UTF-8 for CSV import (#7689) * Convert encoding type to UTF-8 for CSV import * Update bridge_imports.php * Update destination_imports.php * Update device_imports.php * Update destination_imports.php * Update bridge_imports.php * Update access_control_import.php * Update extension_imports.php * Update voicemail_imports.php * Update contact_import.php * Update user_imports.php --- app/access_controls/access_control_import.php | 5 ++++- app/bridges/bridge_imports.php | 11 +++++++---- app/destinations/destination_imports.php | 5 ++++- app/devices/device_imports.php | 5 ++++- app/extensions/extension_imports.php | 5 ++++- app/voicemails/voicemail_imports.php | 5 ++++- core/contacts/contact_import.php | 5 ++++- core/users/user_imports.php | 5 ++++- 8 files changed, 35 insertions(+), 11 deletions(-) diff --git a/app/access_controls/access_control_import.php b/app/access_controls/access_control_import.php index c6a603972a..a04e34a364 100644 --- a/app/access_controls/access_control_import.php +++ b/app/access_controls/access_control_import.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -265,6 +265,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/app/bridges/bridge_imports.php b/app/bridges/bridge_imports.php index 5eb7598dd0..cdb27c7d07 100644 --- a/app/bridges/bridge_imports.php +++ b/app/bridges/bridge_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2024 + Portions created by the Initial Developer are Copyright (C) 2019-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -238,7 +238,7 @@ //user selected fields $fields = $_POST['fields']; - + //set the domain_uuid $domain_uuid = $_SESSION['domain_uuid']; @@ -251,13 +251,16 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; foreach ($fields as $key => $value) { //get the line $result = str_getcsv($line, $delimiter, $enclosure); - + //get the table and field name $field_array = explode(".",$value); $table_name = $field_array[0]; @@ -265,7 +268,7 @@ //echo "value: $value
\n"; //echo "table_name: $table_name
\n"; //echo "field_name: $field_name
\n"; - + //get the parent table name $parent = get_parent($schema, $table_name); diff --git a/app/destinations/destination_imports.php b/app/destinations/destination_imports.php index fa12e0105f..2702fe2611 100644 --- a/app/destinations/destination_imports.php +++ b/app/destinations/destination_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2025 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -167,6 +167,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/app/devices/device_imports.php b/app/devices/device_imports.php index 160a488770..0a66d485db 100644 --- a/app/devices/device_imports.php +++ b/app/devices/device_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2024 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -261,6 +261,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/app/extensions/extension_imports.php b/app/extensions/extension_imports.php index bdd4ed79f8..9f80a54de6 100644 --- a/app/extensions/extension_imports.php +++ b/app/extensions/extension_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2018-2020 + Portions created by the Initial Developer are Copyright (C) 2018-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -260,6 +260,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/app/voicemails/voicemail_imports.php b/app/voicemails/voicemail_imports.php index 38262d6fa3..56e5aad5d4 100644 --- a/app/voicemails/voicemail_imports.php +++ b/app/voicemails/voicemail_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2019-2024 + Portions created by the Initial Developer are Copyright (C) 2019-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -257,6 +257,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/core/contacts/contact_import.php b/core/contacts/contact_import.php index 22f668d22f..46ef09ee47 100644 --- a/core/contacts/contact_import.php +++ b/core/contacts/contact_import.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2024 + Portions created by the Initial Developer are Copyright (C) 2008-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -294,6 +294,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //format the data $y = 0; diff --git a/core/users/user_imports.php b/core/users/user_imports.php index bb571886ab..d7a8135ede 100644 --- a/core/users/user_imports.php +++ b/core/users/user_imports.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2023 + Portions created by the Initial Developer are Copyright (C) 2008-2026 the Initial Developer. All Rights Reserved. Contributor(s): @@ -260,6 +260,9 @@ //loop through the array while (($line = fgets($handle, 4096)) !== false) { + //convert the line to UTF-8 + $line = mb_convert_encoding($line, 'UTF-8'); + if ($from_row <= $row_number) { //get the user_uuid $user_uuid = uuid();