Exported excel sheets contains special symbols instead of apostrophe

Using xls exporter for exporting data into excel sheets, but when the data is exported into excel, apostrophe is being replaced by special symbol. Data is being captured properly in the database without any special symbols. Attaching below screenshot of the same.

Using xls exporter which contains the following code:

<?php class XlsExporter { const CRLF = "\r\n"; /** * Export and download an Active Record resultset to an XML-based xls file * * @param $filename - Name of output filename * @param $data - Active record data set * @param $title - Title displayed on top * @param $header - Boolean to show/hide header * @param $fields - Array of fields to export * @param $type - String that explains what's being exported for the end user (use plural) */ public static function downloadXls($filename, $data, $title = false, $header = false, $fields = false, $type = 'lines') { //$export = self::createXlsString($data, $title, $header, $fields, $type); //$export = self::createEntriesXlsStringFromArray($data, $title, $header, $fields, $type); $export=$data; self::sendHeader($filename, strlen($export), 'vnd.ms-excel'); echo $export; Yii::app()->end(); } /** * Send file header * * @param $filename - Filename for the created file * @param $length - Size of file * @param $type - Mime type of exported data */ private static function sendHeader($filename, $length, $type = 'octet-stream') { if (strtolower(substr($filename, -4)) != '.xls'){ $filename .= '.xls'; } header("Content-type: application/$type"); header("Content-Disposition: attachment; filename=$filename"); header("Content-length: $length"); header('Pragma: no-cache'); header('Expires: 0'); } /** * Private method to create xls string from active record data set * * @param $data - Active record data set * @param $title - Title displayed on top * @param $header - Boolean to show/hide header * @param $fields - Array of fields to export * @param $type - String that explains what's being exported for the end user */ private static function createXlsString($data, $title, $header, $fields, $type) { $string = '' . self::CRLF . '' . self::CRLF . '' . self::CRLF . '' . self::CRLF . '' . self::CRLF; if ($title) $string .= "$title

" . self::CRLF . Yii::t('main', 'Exported '.$type) . ': ' . count($data) . '
' . self::CRLF . Yii::t('main', 'Export date') . ': ' . Yii::app()->dateFormatter->formatDateTime($_SERVER['REQUEST_TIME']) . '

' . self::CRLF; if ($data) { $string .= '' . self::CRLF; if (!$fields) $fields = array_keys($data[0]->attributes); if ($header) { $string .= '' . self::CRLF; foreach ($fields as $field) $string .= '' . self::CRLF; $string .= '' . self::CRLF; } foreach ($data as $row) { $string .= '' . self::CRLF; foreach ($fields as $field) $string .= '' . self::CRLF; $string .= '' . self::CRLF; } $string .= '
' . $data[0]->getAttributeLabel($field) . '
' . $row->$field . '
' . self::CRLF; } $string .= '' . self::CRLF . ''; return $string; } /** * Private method to create xls string from active record data set * * @param $data - Multidimensional Array * @param $title - Title displayed on top * @param $header - Boolean to show/hide header * @param $fields - Array of fields to export * @param $type - String that explains what's being exported for the end user */ private static function createEntriesXlsStringFromArray($data, $title, $header, $fields, $type) { $string = '' . self::CRLF . '' . self::CRLF . '' . self::CRLF . '' . self::CRLF . '' . self::CRLF; if ($title) $string .= "$title

" . self::CRLF . Yii::t('main', 'Exported Entries ') . ': ' . count($data) . '
' . self::CRLF . Yii::t('main', 'Export date') . ': ' . Yii::app()->dateFormatter->formatDateTime($_SERVER['REQUEST_TIME']) . '

' . self::CRLF; if ($data) { $string .= '' . self::CRLF; if (!$fields) $fields = array_keys($data[0]); if ($header) { $string .= '' . self::CRLF; $string .= '' . self::CRLF; foreach ($fields as $field) $string .= '' . self::CRLF; $string .= '' . self::CRLF; } foreach ($data as $k => $row) { $string .= '' . self::CRLF; $string .= '' . self::CRLF; foreach ($fields as $field) $string .= '' . self::CRLF; $string .= '' . self::CRLF; } $string .= '
S.no' . $field . '
' . ($k+1) . '' . $row[$field] . '
' . self::CRLF; } $string .= '' . self::CRLF . ''; return $string; } }