public function FrxDocument::convertCharset in Forena Reports 7.3
Same name and namespace in other branches
- 7.4 FrxDocument.inc \FrxDocument::convertCharset()
3 calls to FrxDocument::convertCharset()
- FrxCSVDoc::output in docformats/
FrxCSVDoc.inc - FrxWordDoc::output in docformats/
FrxWordDoc.inc - FrxXLSDoc::output in docformats/
FrxXLSDoc.inc
File
- ./
FrxDocument.inc, line 89 - FrxDocument.inc Given a report, render the appropriate output given the document format. @author davidmetzler
Class
- FrxDocument
- @file FrxDocument.inc Given a report, render the appropriate output given the document format. @author davidmetzler
Code
public function convertCharset($data, $default_encoding = 'UTF-8') {
if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
$parts = @explode(';', $_SERVER['HTTP_ACCEPT_CHARSET']);
$parts = @explode(',', $parts[0]);
$to_encoding = @$parts[0];
}
else {
$to_encoding = $default_encoding;
}
if ($to_encoding != 'UTF-8') {
$this->charset = $to_encoding;
$data = mb_convert_encoding($data, $to_encoding, 'UTF-8');
}
return $data;
}