filters invalid utf8 characters in VEVENT blobs
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 19 Aug 2014 14:25:52 +0000 (16:25 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 4 Sep 2014 09:26:43 +0000 (11:26 +0200)
Change-Id: I5c429644f3a32d1c59272182669b7bc666b551c0
Reviewed-on: http://gerrit.tine20.com/customers/1018
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Convert/Event/VCalendar/GenericTest.php
tests/tine20/Calendar/Import/files/invalid_utf8.ics [new file with mode: 0644]
tine20/Calendar/Convert/Event/VCalendar/Abstract.php

index 070a6e9..77e80bb 100644 (file)
@@ -698,6 +698,15 @@ class Calendar_Convert_Event_VCalendar_GenericTest extends PHPUnit_Framework_Tes
     }
     
     /**
+     * testInvalidUtf8
+     */
+    public function testInvalidUtf8()
+    {
+        $savedEvent = $this->_saveIcsEvent('invalid_utf8.ics');
+        $this->assertContains('Hoppegarten Day', $savedEvent->summary);
+    }
+    
+    /**
      * testLongLocation
      */
     public function testLongLocation()
diff --git a/tests/tine20/Calendar/Import/files/invalid_utf8.ics b/tests/tine20/Calendar/Import/files/invalid_utf8.ics
new file mode 100644 (file)
index 0000000..976bba4
--- /dev/null
@@ -0,0 +1,33 @@
+BEGIN:VCALENDAR
+CALSCALE:GREGORIAN
+PRODID:-//Apple Inc.//iOS 5.0.1//EN
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:Europe/Berlin
+BEGIN:DAYLIGHT
+DTSTART:19810329T020000
+RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
+TZNAME:CEST
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+END:DAYLIGHT
+BEGIN:STANDARD
+DTSTART:19961027T030000
+RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
+TZNAME:CET
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+END:STANDARD
+END:VTIMEZONE
+BEGIN:VEVENT
+CREATED:20120322T111346Z
+DTEND;TZID=Europe/Berlin:20120527T140000
+DTSTAMP:20120323T092243Z
+DTSTART;TZID=Europe/Berlin:20120527T130000
+LAST-MODIFIED:20120322T111346Z
+SEQUENCE:0
+SUMMARY:🐎Hoppegarten Day
+TRANSP:OPAQUE
+UID:05D94964-F0A9-47B0-9433-D5E12EB140FA
+END:VEVENT
+END:VCALENDAR
index c3a2072..adf3a79 100644 (file)
@@ -571,6 +571,8 @@ class Calendar_Convert_Event_VCalendar_Abstract implements Tinebase_Convert_Inte
             $blob = stream_get_contents($blob);
         }
         
+        $blob = Tinebase_Core::filterInputForDatabase($blob);
+        
         $vcalendar = self::readVCalBlob($blob);
         
         return $vcalendar;