|
@@ -27,6 +27,7 @@ class Response
|
|
protected $version;
|
|
protected $version;
|
|
protected $statusCode;
|
|
protected $statusCode;
|
|
protected $statusText;
|
|
protected $statusText;
|
|
|
|
+ protected $charset = 'UTF-8';
|
|
|
|
|
|
static public $statusTexts = array(
|
|
static public $statusTexts = array(
|
|
100 => 'Continue',
|
|
100 => 'Continue',
|
|
@@ -96,7 +97,7 @@ class Response
|
|
$content = '';
|
|
$content = '';
|
|
|
|
|
|
if (!$this->headers->has('Content-Type')) {
|
|
if (!$this->headers->has('Content-Type')) {
|
|
- $this->headers->set('Content-Type', 'text/html');
|
|
|
|
|
|
+ $this->headers->set('Content-Type', 'text/html; charset='.$this->charset);
|
|
}
|
|
}
|
|
|
|
|
|
// status
|
|
// status
|
|
@@ -128,7 +129,7 @@ class Response
|
|
public function sendHeaders()
|
|
public function sendHeaders()
|
|
{
|
|
{
|
|
if (!$this->headers->has('Content-Type')) {
|
|
if (!$this->headers->has('Content-Type')) {
|
|
- $this->headers->set('Content-Type', 'text/html');
|
|
|
|
|
|
+ $this->headers->set('Content-Type', 'text/html; charset='.$this->charset);
|
|
}
|
|
}
|
|
|
|
|
|
// status
|
|
// status
|
|
@@ -227,6 +228,26 @@ class Response
|
|
return $this->statusCode;
|
|
return $this->statusCode;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Sets response charset.
|
|
|
|
+ *
|
|
|
|
+ * @param string $charset Character set
|
|
|
|
+ */
|
|
|
|
+ public function setCharset($charset)
|
|
|
|
+ {
|
|
|
|
+ $this->charset = $charset;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Retrieves the response charset.
|
|
|
|
+ *
|
|
|
|
+ * @return string Character set
|
|
|
|
+ */
|
|
|
|
+ public function getCharset()
|
|
|
|
+ {
|
|
|
|
+ return $this->charset;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Returns true if the response is worth caching under any circumstance.
|
|
* Returns true if the response is worth caching under any circumstance.
|
|
*
|
|
*
|