Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/iconv-set-output-charset' of https://github.com/…
Browse files Browse the repository at this point in the history
…Maks3w/zf2 into feature/mail-lazy-headers
  • Loading branch information
weierophinney committed Jul 2, 2012
2 parents 5b8ff35 + d7b4982 commit 5e018e7
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Header/AbstractAddressList.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class AbstractAddressList implements HeaderInterface
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');

// split into name/value
list($fieldName, $fieldValue) = explode(': ', $headerLine, 2);
Expand Down Expand Up @@ -98,7 +98,7 @@ public static function fromString($headerLine)
if (empty($name)) {
$name = null;
} else {
$name = iconv_mime_decode($name, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$name = iconv_mime_decode($name, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
}

if (isset($matches['namedEmail'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Header/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ContentType implements HeaderInterface
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = explode(': ', $headerLine, 2);

// check to ensure proper header type for this factory
Expand Down
2 changes: 1 addition & 1 deletion src/Header/GenericHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class GenericHeader implements HeaderInterface
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
$parts = explode(': ', $headerLine, 2);
if (count($parts) != 2) {
throw new Exception\InvalidArgumentException('Header must match with the format "name: value"');
Expand Down
2 changes: 1 addition & 1 deletion src/Header/GenericMultiHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GenericMultiHeader extends GenericHeader implements MultipleHeadersInterfa
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
$parts = explode(': ', $headerLine, 2);
if (count($parts) != 2) {
throw new Exception\InvalidArgumentException('Header must match with the format "name: value"');
Expand Down
4 changes: 2 additions & 2 deletions src/Header/Sender.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Sender implements HeaderInterface
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = explode(': ', $headerLine, 2);

// check to ensure proper header type for this factory
Expand All @@ -69,7 +69,7 @@ public static function fromString($headerLine)
if (empty($name)) {
$name = null;
} else {
$name = iconv_mime_decode($name, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$name = iconv_mime_decode($name, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
}
$header->setAddress($matches['email'], $name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Header/Subject.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Subject implements UnstructuredInterface
*/
public static function fromString($headerLine)
{
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
$headerLine = iconv_mime_decode($headerLine, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8');
list($name, $value) = explode(': ', $headerLine, 2);

// check to ensure proper header type for this factory
Expand Down
2 changes: 1 addition & 1 deletion test/Header/HeaderWrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testWrapUnstructuredHeaderMime()

$test = HeaderWrap::wrap($string, $header);
$this->assertEquals($expected, $test);
$this->assertEquals($string, iconv_mime_decode($test));
$this->assertEquals($string, iconv_mime_decode($test, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'));
}

/**
Expand Down
7 changes: 2 additions & 5 deletions test/Storage/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ public function testGetDecodedHeader()
{
$message = new Message(array('file' => $this->_file));

$this->assertEquals($message->from, iconv('UTF-8', iconv_get_encoding('internal_encoding'),
'"Peter Müller" <[email protected]>'));
$this->assertEquals('"Peter Müller" <[email protected]>', $message->from);
}

public function testGetHeaderAsArray()
Expand Down Expand Up @@ -213,9 +212,7 @@ public function testIterator()
public function testDecodeString()
{
$is = Mime\Decode::decodeQuotedPrintable('=?UTF-8?Q?"Peter M=C3=BCller"?= <[email protected]>');
$should = iconv('UTF-8', iconv_get_encoding('internal_encoding'),
'"Peter Müller" <[email protected]>');
$this->assertEquals($is, $should);
$this->assertEquals('"Peter Müller" <[email protected]>', $is);
}

public function testSplitHeader()
Expand Down

0 comments on commit 5e018e7

Please sign in to comment.