Development

Changeset 6762

You must first sign up to be able to contribute.

Changeset 6762

Show
Ignore:
Timestamp:
12/27/07 16:44:55 (2 years ago)
Author:
fabien
Message:

fixed content type charset on non text/* content-type (closes #1811, #1968)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/response/sfWebResponse.class.php

    r6662 r6762  
    247247  { 
    248248    // add charset if needed 
    249     if (false === stripos($value, 'charset')
     249    if (false === stripos($value, 'charset') && 0 === stripos($value, 'text/')
    250250    { 
    251251      $value .= '; charset='.$this->getParameter('charset'); 
  • branches/1.1/test/unit/response/sfWebResponseTest.php

    r6665 r6762  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(64, new lime_output_color()); 
     13$t = new lime_test(65, new lime_output_color()); 
    1414 
    1515class myWebResponse extends sfWebResponse 
     
    111111$t->is($response->getContentType(), 'text/xml;charset = ISO-8859-1', '->setContentType() does nothing if a charset is given'); 
    112112 
     113$response->setContentType('image/jpg'); 
     114$t->is($response->getContentType(), 'image/jpg', '->setContentType() does not add a charset if the content-type is not text/*'); 
     115 
    113116$t->is($response->getContentType(), $response->getHttpHeader('content-type'), '->getContentType() is an alias for ->getHttpHeader(\'content-type\')'); 
    114117 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.