From f9496a89b1cdbb8bed26742f19fc36559e502264 Mon Sep 17 00:00:00 2001 From: arno Date: Mon, 18 Apr 2011 18:28:25 +0200 Subject: [PATCH] set charset in default content-type http header --- application/configs/application.ini | 1 + application/controllers/helpers/SyjApi.php | 4 ++-- application/controllers/plugins/SyjContentType.php | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 application/controllers/plugins/SyjContentType.php diff --git a/application/configs/application.ini b/application/configs/application.ini index d80dbb3..d3520cd 100644 --- a/application/configs/application.ini +++ b/application/configs/application.ini @@ -22,6 +22,7 @@ resources.frontController.defaultloc.maxlat = 70.0 resources.frontController.actionhelperpaths.Syj_Controller_Action_Helper = APPLICATION_PATH "/controllers/helpers" resources.frontController.plugins.locale = "Syj_Controllers_Plugins_SyjLocale" resources.frontController.plugins.loggeduser = "Syj_Controllers_Plugins_SyjLoggedUser" +resources.frontController.plugins.contenttype = "Syj_Controllers_Plugins_SyjContentType" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" resources.db.adapter = "Pdo_Pgsql" ; i18n diff --git a/application/controllers/helpers/SyjApi.php b/application/controllers/helpers/SyjApi.php index 92974c5..6016f99 100644 --- a/application/controllers/helpers/SyjApi.php +++ b/application/controllers/helpers/SyjApi.php @@ -78,8 +78,8 @@ class Syj_Controller_Action_Helper_SyjApi extends Zend_Controller_Action_Helper_ public function postDispatch() { $response = $this->getResponse(); - $response->setHeader('Content-Type', $this->_contentType) - ->setHeader('Content-Length', strlen($this->_body)); + $response->setHeader('Content-Type', $this->_contentType, true) + ->setHeader('Content-Length', strlen($this->_body), true); if ($this->_checkIfNoneMatch) { $request = $this->getRequest(); diff --git a/application/controllers/plugins/SyjContentType.php b/application/controllers/plugins/SyjContentType.php new file mode 100644 index 0000000..782b0f2 --- /dev/null +++ b/application/controllers/plugins/SyjContentType.php @@ -0,0 +1,12 @@ +getResponse(); + $response->setHeader('Content-Type', 'text/html; charset=utf-8', true); + } +} -- 2.39.2