Skip to content

Commit

Permalink
fix utf-8 encoding of calendar response
Browse files Browse the repository at this point in the history
resolves #4
  • Loading branch information
fdyckhoff committed Aug 20, 2017
1 parent eeca3e3 commit 9b3ff8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Response/CalendarResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ class CalendarResponse extends Response
public function __construct(Calendar $calendar, $status = 200, $headers = array())
{
$this->calendar = $calendar;
$content = utf8_encode($calendar->createCalendar());

// convert to UTF-8
$content = $calendar->createCalendar();
if (!mb_check_encoding($content, 'UTF-8')) {
$content = utf8_encode($content);
}

$headers = array_merge($this->getDefaultHeaders(), $headers);
parent::__construct($content, $status, $headers);
}
Expand Down

0 comments on commit 9b3ff8c

Please sign in to comment.