Better character encoding handling.
authorCameron Ball <c.ball1729@gmail.com>
Sun, 28 Dec 2014 17:38:29 +0000 (01:38 +0800)
committerCameron Ball <c.ball1729@gmail.com>
Sun, 28 Dec 2014 17:38:29 +0000 (01:38 +0800)
.gitignore
DataAccess/DataMapper/Helpers/AbstractPopulationHelper.php
Services/SimfileParser.php
Services/Uploads/UploadManager.php
Services/ZipParser.php

index c1cdda3..75bb758 100644 (file)
@@ -3,6 +3,7 @@ logs
 composer.lock
 vendor
 db.php
+files/*
 files/StepMania/*
 files/banners/*
 !files/banners/default.png
index 00a442a..8e9ac84 100644 (file)
@@ -202,6 +202,8 @@ class AbstractPopulationHelper
                         }\r
                         break;\r
                     case 'DataAccess\DataMapper\Helpers\VarcharMapsHelper':\r
+                        //XXX: pls magically fix all my character encoding issues.\r
+                        $property = mb_convert_encoding($property, "UTF-8", mb_detect_encoding($property, "UTF-8, ISO-8859-1, ISO-8859-15", true));\r
                         if($id){\r
                             //easy case, plain values in our table.\r
                             $query .= sprintf('%s="%s", ',\r
index fcb5618..c0245cb 100644 (file)
@@ -33,9 +33,8 @@ class SimfileParser implements ISimfileParser
     {
         $title = $this->extractKey('TITLE');
         if(!$title) throw new InvalidSmFileException('Invalid SM file. TITLE missing');
-        
-        //XXX: UTF8 encode to deal with unusual character that crop up in weeaboo shit.
-        return utf8_encode($title);
+
+        return $title;
     }
     
     public function artist()
@@ -45,7 +44,7 @@ class SimfileParser implements ISimfileParser
         if(!$artist)return null;
         
         //XXX: UTF8 encode to deal with unusual character that crop up in weeaboo shit.
-        return new \Domain\VOs\StepMania\Artist(utf8_encode($artist));
+        return new \Domain\VOs\StepMania\Artist($artist);
     }
     
     public function stops()
@@ -148,7 +147,7 @@ class SimfileParser implements ISimfileParser
         return new \Domain\VOs\StepMania\StepChart(
             new \Domain\VOs\StepMania\DanceMode($stepData[0]),
             new \Domain\VOs\StepMania\Difficulty($stepData[2]),
-            empty($stepData[1]) ? null : new \Domain\VOs\StepMania\StepArtist(utf8_encode($stepData[1])),
+            empty($stepData[1]) ? null : new \Domain\VOs\StepMania\StepArtist($stepData[1]),
             //XXX: Fuck you whoever made me do this. http://dev.mysql.com/doc/refman/5.5/en/integer-types.html
             //XXX: Originally I was using MySQL unsigned bigint max value, but PHP does not have unsigned ints so
             $stepData[3] <= 9223372036854775807 ? $stepData[3] : 9223372036854775807
index 81a6413..c1356ae 100644 (file)
@@ -26,7 +26,7 @@ class UploadManager implements IUploadManager{
             foreach($_FILES as $file)
             {
                 $this->_files[] = $this->_fileFactory->createInstance(
-                utf8_encode($file['name']),
+                    $file['name'],
                     $file['type'],
                     $file['tmp_name'],
                     $file['size']
index 380a6c4..528771c 100644 (file)
@@ -142,7 +142,7 @@ class ZipParser implements IZipParser
                 throw new Exception('Malformed zip. I found more than 1 sm file but the directory structure is not consistent with a pack.');
         }
         
-        return utf8_encode($packName);
+        return $packName;
     }
         
     private function SmDataToSmClass($smData)