public function getCharset()
{
$app = $this->getApplication()->getGlobalization(false);
//instance charset
$charset = $this->getViewState('Charset', '');
//fall back to globalization charset
if (empty($charset)) {
$charset = $app === null ? '' : $app->getCharset();
}
//fall back to default charset
if (empty($charset)) {
$charset = $app === null ? 'UTF-8' : $app->getDefaultCharset();
}
return $charset;
}