From e660f1640a64af6dd9bb2381405b34a6f969d2ae Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Sun, 30 Jun 2019 23:29:58 +0100 Subject: [PATCH] Make sure that ADIF logs are always handled as UTF-8 encoded to support international langs --- application/controllers/Adif.php | 1 + application/libraries/Adif_parser.php | 2 +- application/models/Logbook_model.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/application/controllers/Adif.php b/application/controllers/Adif.php index 5dde10b1..4907a592 100644 --- a/application/controllers/Adif.php +++ b/application/controllers/Adif.php @@ -13,6 +13,7 @@ class adif extends CI_Controller { if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } } + /* Shows Export Views */ public function export() { diff --git a/application/libraries/Adif_parser.php b/application/libraries/Adif_parser.php index fbf711ae..a7a560bd 100644 --- a/application/libraries/Adif_parser.php +++ b/application/libraries/Adif_parser.php @@ -117,7 +117,7 @@ class ADIF_Parser public function load_from_file($fname) //allows the user to accept a filename as input { - $this->data = file_get_contents($fname); + $this->data = $string = mb_convert_encoding(file_get_contents($fname), "UTF-8"); } //the following function does the processing of the array into its key and value pairs diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 12fbc01b..253efa0a 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -877,6 +877,7 @@ class Logbook_model extends CI_Model { function import($record) { $CI =& get_instance(); $CI->load->library('frequency'); + // Join date+time $time_on = date('Y-m-d', strtotime($record['qso_date'])) ." ".date('H:i', strtotime($record['time_on']));