From de4934a31745aa59bd83e5866f37b8a42e290645 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Tue, 30 Apr 2013 15:00:31 -0400 Subject: [PATCH] ensure that uploaded file is UTF-8 encoded --- airtime_mvc/application/models/StoredFile.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index a85d3e602..0b743e849 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -1017,6 +1017,9 @@ SQL; Logging::info("Successfully written identification file for uploaded '$audio_stor'"); } + //if the uploaded file is not UTF-8 encoded, let's encode it. Assuming source + //encoding is ISO-8859-1 + $audio_stor = mb_detect_encoding($audio_stor, "UTF-8") == "UTF-8" ? $audio_stor : utf8_encode($audio_stor); Logging::info("copyFileToStor: moving file $audio_file to $audio_stor"); // Martin K.: changed to rename: Much less load + quicker since this is // an atomic operation